SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE TABLE `automacoes_master` ( `id` int(11) NOT NULL AUTO_INCREMENT, `descricao` varchar(255) DEFAULT NULL, `plataforma` varchar(255) DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8; CREATE TABLE `logs` ( `id` int(11) NOT NULL AUTO_INCREMENT, `modulo` varchar(255) DEFAULT NULL, `acao` varchar(255) DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8; CREATE TABLE `transacoes` ( `id` int(11) NOT NULL AUTO_INCREMENT, `data` date DEFAULT NULL, `valor` varchar(255) DEFAULT NULL, `descricao` varchar(255) DEFAULT NULL, `tipo` varchar(255) DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8; CREATE TABLE `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `nome` varchar(255) DEFAULT NULL, `senha` varchar(255) DEFAULT NULL, `email` varchar(255) DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8; CREATE TABLE `automacoes_detail` ( `id` int(11) NOT NULL AUTO_INCREMENT, `id_aut_master` int(11) NOT NULL, `script` varchar(255) NOT NULL, `parametros` varchar(255) NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `id_aut_master` (`id_aut_master`), CONSTRAINT `automacoes_detail_constraint_1` FOREIGN KEY (`id_aut_master`) REFERENCES `automacoes_master` (`id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8; CREATE TABLE `contas` ( `id` int(11) NOT NULL AUTO_INCREMENT, `cc` varchar(255) NOT NULL, `saldo` varchar(255) NOT NULL, `atualizada` varchar(255) NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8; CREATE TABLE `empresas` ( `id` int(11) NOT NULL AUTO_INCREMENT, `cnpj` varchar(255) NOT NULL, `razaosocial` varchar(255) NOT NULL, `nomefantasia` varchar(255) NOT NULL, `id_contas` int(11) NOT NULL, `endereco` varchar(255) NOT NULL, `cidade` varchar(255) NOT NULL, `estado` varchar(255) NOT NULL, `telefone` varchar(255) NOT NULL, `nomecontato` varchar(255) NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `id_contas` (`id_contas`), CONSTRAINT `empresas_constraint_1` FOREIGN KEY (`id_contas`) REFERENCES `contas` (`id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8; CREATE TABLE `permissoes_automacao` ( `id` int(11) NOT NULL AUTO_INCREMENT, `id_aut_master` int(11) NOT NULL, `id_empresas` int(11) NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `id_aut_master` (`id_aut_master`), KEY `id_empresa` (`id_empresas`), CONSTRAINT `permissoes_automacao_constraint_1` FOREIGN KEY (`id_aut_master`) REFERENCES `automacoes_master` (`id`), CONSTRAINT `permissoes_automacao_constraint_2` FOREIGN KEY (`id_empresas`) REFERENCES `empresas` (`id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8; CREATE TABLE `permissoes_empresa` ( `id` int(11) NOT NULL AUTO_INCREMENT, `id_users` int(11) DEFAULT NULL, `id_empresas` int(11) DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `id_user` (`id_users`), KEY `id_empresa` (`id_empresas`), CONSTRAINT `permissoes_empresa_constraint_1` FOREIGN KEY (`id_users`) REFERENCES `users` (`id`), CONSTRAINT `permissoes_empresa_constraint_2` FOREIGN KEY (`id_empresas`) REFERENCES `empresas` (`id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8; CREATE TABLE `historico` ( `id` int(11) NOT NULL AUTO_INCREMENT, `id_users` int(11) DEFAULT NULL, `id_empresas` int(11) DEFAULT NULL, `data` date DEFAULT NULL, `id_transacoes` int(11) DEFAULT NULL, `id_contas` int(11) DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `id_usuario` (`id_users`), KEY `id_transacao` (`id_transacoes`), KEY `id_empresa` (`id_empresas`), KEY `id_contas` (`id_contas`), CONSTRAINT `historico_constraint_1` FOREIGN KEY (`id_users`) REFERENCES `users` (`id`), CONSTRAINT `historico_constraint_2` FOREIGN KEY (`id_transacoes`) REFERENCES `transacoes` (`id`), CONSTRAINT `historico_constraint_3` FOREIGN KEY (`id_empresas`) REFERENCES `empresas` (`id`), CONSTRAINT `historico_constraint_4` FOREIGN KEY (`id_contas`) REFERENCES `contas` (`id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8;
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear