Advertisement
Guest User

Untitled

a guest
Jul 15th, 2013
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 10.81 KB | None | 0 0
  1.  
  2. CREATE TABLE IF NOT EXISTS `acl_classes` (
  3.   `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  4.   `class_type` VARCHAR(200) COLLATE utf8_unicode_ci NOT NULL,
  5.   PRIMARY KEY (`id`),
  6.   UNIQUE KEY `UNIQ_69DD750638A36066` (`class_type`)
  7. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
  8.  
  9.  
  10. CREATE TABLE IF NOT EXISTS `acl_entries` (
  11.   `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  12.   `class_id` INT(10) UNSIGNED NOT NULL,
  13.   `object_identity_id` INT(10) UNSIGNED DEFAULT NULL,
  14.   `security_identity_id` INT(10) UNSIGNED NOT NULL,
  15.   `field_name` VARCHAR(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  16.   `ace_order` SMALLINT(5) UNSIGNED NOT NULL,
  17.   `mask` INT(11) NOT NULL,
  18.   `granting` tinyint(1) NOT NULL,
  19.   `granting_strategy` VARCHAR(30) COLLATE utf8_unicode_ci NOT NULL,
  20.   `audit_success` tinyint(1) NOT NULL,
  21.   `audit_failure` tinyint(1) NOT NULL,
  22.   PRIMARY KEY (`id`),
  23.   UNIQUE KEY `UNIQ_46C8B806EA000B103D9AB4A64DEF17BCE4289BF4` (`class_id`,`object_identity_id`,`field_name`,`ace_order`),
  24.   KEY `IDX_46C8B806EA000B103D9AB4A6DF9183C9` (`class_id`,`object_identity_id`,`security_identity_id`),
  25.   KEY `IDX_46C8B806EA000B10` (`class_id`),
  26.   KEY `IDX_46C8B8063D9AB4A6` (`object_identity_id`),
  27.   KEY `IDX_46C8B806DF9183C9` (`security_identity_id`)
  28. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
  29.  
  30.  
  31.  
  32. CREATE TABLE IF NOT EXISTS `acl_object_identities` (
  33.   `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  34.   `parent_object_identity_id` INT(10) UNSIGNED DEFAULT NULL,
  35.   `class_id` INT(10) UNSIGNED NOT NULL,
  36.   `object_identifier` VARCHAR(100) COLLATE utf8_unicode_ci NOT NULL,
  37.   `entries_inheriting` tinyint(1) NOT NULL,
  38.   PRIMARY KEY (`id`),
  39.   UNIQUE KEY `UNIQ_9407E5494B12AD6EA000B10` (`object_identifier`,`class_id`),
  40.   KEY `IDX_9407E54977FA751A` (`parent_object_identity_id`)
  41. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
  42.  
  43.  
  44. CREATE TABLE IF NOT EXISTS `acl_object_identity_ancestors` (
  45.   `object_identity_id` INT(10) UNSIGNED NOT NULL,
  46.   `ancestor_id` INT(10) UNSIGNED NOT NULL,
  47.   PRIMARY KEY (`object_identity_id`,`ancestor_id`),
  48.   KEY `IDX_825DE2993D9AB4A6` (`object_identity_id`),
  49.   KEY `IDX_825DE299C671CEA1` (`ancestor_id`)
  50. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  51.  
  52.  
  53.  
  54. CREATE TABLE IF NOT EXISTS `acl_security_identities` (
  55.   `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  56.   `identifier` VARCHAR(200) COLLATE utf8_unicode_ci NOT NULL,
  57.   `username` tinyint(1) NOT NULL,
  58.   PRIMARY KEY (`id`),
  59.   UNIQUE KEY `UNIQ_8835EE78772E836AF85E0677` (`identifier`,`username`)
  60. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
  61.  
  62.  
  63.  
  64. CREATE TABLE IF NOT EXISTS `administradores` (
  65.   `id` INT(11) NOT NULL AUTO_INCREMENT,
  66.   `email` VARCHAR(45) NOT NULL,
  67.   `nome` VARCHAR(45) NOT NULL,
  68.   `password` VARCHAR(120) NOT NULL,
  69.   `salt` VARCHAR(32) NOT NULL,
  70.   `roles` longtext NOT NULL COMMENT '(DC2Type:array)',
  71.   `data_cadastro` datetime NOT NULL,
  72.   `cro` VARCHAR(120) DEFAULT NULL,
  73.   `curso` VARCHAR(120) DEFAULT NULL,
  74.   `turma` VARCHAR(120) DEFAULT NULL,
  75.   `coordenador` VARCHAR(120) DEFAULT NULL,
  76.   `type` VARCHAR(120) DEFAULT NULL,
  77.   PRIMARY KEY (`id`)
  78. ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  79.  
  80.  
  81. CREATE TABLE IF NOT EXISTS `atendimento` (
  82.   `id` INT(11) NOT NULL AUTO_INCREMENT,
  83.   `detalhes` text NOT NULL,
  84.   `execucao_id` INT(11) DEFAULT NULL,
  85.   PRIMARY KEY (`id`),
  86.   UNIQUE KEY `UNIQ_3FA50F2C892D0ABB` (`execucao_id`)
  87. ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  88.  
  89.  
  90.  
  91. CREATE TABLE IF NOT EXISTS `contrato` (
  92.   `id` INT(11) NOT NULL AUTO_INCREMENT,
  93.   `paciente_id` INT(11) DEFAULT NULL,
  94.   `orcamento_id` INT(11) DEFAULT NULL,
  95.   `data_cadastro` datetime NOT NULL,
  96.   `cirurgiao_id` INT(11) DEFAULT NULL,
  97.   PRIMARY KEY (`id`),
  98.   KEY `fk_contrato_paciente1_idx` (`paciente_id`),
  99.   KEY `fk_contrato_orcamento1_idx` (`orcamento_id`),
  100.   KEY `fk_contrato_administradores1_idx` (`cirurgiao_id`)
  101. ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  102.  
  103.  
  104. CREATE TABLE IF NOT EXISTS `execucao` (
  105.   `id` INT(11) NOT NULL AUTO_INCREMENT,
  106.   `procedimento_id` INT(11) DEFAULT NULL,
  107.   `data_cadastro` datetime NOT NULL,
  108.   `administradores_id` INT(11) DEFAULT NULL,
  109.   `finalizado` tinyint(1) DEFAULT NULL,
  110.   `atendimento_id` INT(11) DEFAULT NULL,
  111.   `implante_id` INT(11) DEFAULT NULL,
  112.   PRIMARY KEY (`id`),
  113.   UNIQUE KEY `UNIQ_139E7F7676323123` (`atendimento_id`),
  114.   UNIQUE KEY `UNIQ_139E7F76957594D7` (`implante_id`),
  115.   KEY `fk_execucao_procedimento1_idx` (`procedimento_id`),
  116.   KEY `fk_execucao_administradores1_idx` (`administradores_id`)
  117. ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  118.  
  119.  
  120.  
  121. CREATE TABLE IF NOT EXISTS `implante` (
  122.   `id` INT(11) NOT NULL AUTO_INCREMENT,
  123.   `implante_tipo_id` INT(11) DEFAULT NULL,
  124.   `implante_marca_id` INT(11) DEFAULT NULL,
  125.   `detalhes` text NOT NULL,
  126.   `medidas` VARCHAR(100) NOT NULL,
  127.   `regiao` VARCHAR(45) NOT NULL,
  128.   `recall` INT(11) NOT NULL,
  129.   `execucao_id` INT(11) DEFAULT NULL,
  130.   PRIMARY KEY (`id`),
  131.   UNIQUE KEY `UNIQ_A05F8138892D0ABB` (`execucao_id`),
  132.   KEY `fk_implante_implante_tipo1_idx` (`implante_tipo_id`),
  133.   KEY `fk_implante_implante_marca1_idx` (`implante_marca_id`)
  134. ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  135.  
  136.  
  137.  
  138. CREATE TABLE IF NOT EXISTS `implante_marca` (
  139.   `id` INT(11) NOT NULL AUTO_INCREMENT,
  140.   `nome` VARCHAR(45) NOT NULL,
  141.   PRIMARY KEY (`id`)
  142. ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  143.  
  144.  
  145. CREATE TABLE IF NOT EXISTS `implante_tipo` (
  146.   `id` INT(11) NOT NULL AUTO_INCREMENT,
  147.   `nome` VARCHAR(45) NOT NULL,
  148.   PRIMARY KEY (`id`)
  149. ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  150.  
  151.  
  152.  
  153. CREATE TABLE IF NOT EXISTS `orcamento` (
  154.   `id` INT(11) NOT NULL AUTO_INCREMENT,
  155.   `paciente_id` INT(11) DEFAULT NULL,
  156.   `data_cadastro` datetime NOT NULL,
  157.   `valor` FLOAT NOT NULL,
  158.   `parcelas` INT(11) NOT NULL,
  159.   `valor_parcela` FLOAT NOT NULL,
  160.   `forma_pagamento` VARCHAR(10) NOT NULL,
  161.   `cheque` longtext COMMENT '(DC2Type:array)',
  162.   `credito` longtext COMMENT '(DC2Type:array)',
  163.   `debito` longtext COMMENT '(DC2Type:array)',
  164.   PRIMARY KEY (`id`),
  165.   KEY `fk_orcamento_pacientes_idx` (`paciente_id`)
  166. ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  167.  
  168.  
  169.  
  170. CREATE TABLE IF NOT EXISTS `paciente` (
  171.   `id` INT(11) NOT NULL AUTO_INCREMENT,
  172.   `nome` VARCHAR(100) NOT NULL,
  173.   `rg` VARCHAR(15) NOT NULL,
  174.   `cpf` VARCHAR(11) NOT NULL,
  175.   `telefone` VARCHAR(11) NOT NULL,
  176.   `celular` VARCHAR(11) DEFAULT NULL,
  177.   `endereco` VARCHAR(300) NOT NULL,
  178.   `cidade` VARCHAR(45) NOT NULL,
  179.   `estado` VARCHAR(2) NOT NULL,
  180.   `data_cadastro` datetime NOT NULL,
  181.   PRIMARY KEY (`id`)
  182. ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  183.  
  184.  
  185.  
  186. CREATE TABLE IF NOT EXISTS `procedimento` (
  187.   `id` INT(11) NOT NULL AUTO_INCREMENT,
  188.   `tipo_procedimento_id` INT(11) DEFAULT NULL,
  189.   `regiao_procedimento_id` INT(11) DEFAULT NULL,
  190.   `valor` FLOAT NOT NULL,
  191.   `orcamento_id` INT(11) DEFAULT NULL,
  192.   `quantidade` INT(11) DEFAULT NULL,
  193.   PRIMARY KEY (`id`),
  194.   KEY `fk_procedimento_tipo_procedimento1_idx` (`tipo_procedimento_id`),
  195.   KEY `fk_procedimento_regiao_procedimento1_idx` (`regiao_procedimento_id`),
  196.   KEY `IDX_CD974452A01CF1CA` (`orcamento_id`)
  197. ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  198.  
  199.  
  200.  
  201. CREATE TABLE IF NOT EXISTS `procedimento_regiao` (
  202.   `id` INT(11) NOT NULL AUTO_INCREMENT,
  203.   `nome` VARCHAR(100) NOT NULL,
  204.   PRIMARY KEY (`id`)
  205. ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  206.  
  207.  
  208. CREATE TABLE IF NOT EXISTS `procedimento_tipo` (
  209.   `id` INT(11) NOT NULL AUTO_INCREMENT,
  210.   `nome` VARCHAR(100) NOT NULL,
  211.   `valor` DOUBLE DEFAULT NULL,
  212.   PRIMARY KEY (`id`)
  213. ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  214.  
  215.  
  216.  
  217. ALTER TABLE `acl_entries`
  218.   ADD CONSTRAINT `FK_46C8B8063D9AB4A6` FOREIGN KEY (`object_identity_id`) REFERENCES `acl_object_identities` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  219.   ADD CONSTRAINT `FK_46C8B806DF9183C9` FOREIGN KEY (`security_identity_id`) REFERENCES `acl_security_identities` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  220.   ADD CONSTRAINT `FK_46C8B806EA000B10` FOREIGN KEY (`class_id`) REFERENCES `acl_classes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  221.  
  222. ALTER TABLE `acl_object_identities`
  223.   ADD CONSTRAINT `FK_9407E54977FA751A` FOREIGN KEY (`parent_object_identity_id`) REFERENCES `acl_object_identities` (`id`);
  224.  
  225. ALTER TABLE `acl_object_identity_ancestors`
  226.   ADD CONSTRAINT `FK_825DE2993D9AB4A6` FOREIGN KEY (`object_identity_id`) REFERENCES `acl_object_identities` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  227.   ADD CONSTRAINT `FK_825DE299C671CEA1` FOREIGN KEY (`ancestor_id`) REFERENCES `acl_object_identities` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  228.  
  229. ALTER TABLE `atendimento`
  230.   ADD CONSTRAINT `FK_3FA50F2C892D0ABB` FOREIGN KEY (`execucao_id`) REFERENCES `execucao` (`id`);
  231.  
  232. ALTER TABLE `contrato`
  233.   ADD CONSTRAINT `fk_contrato_administradores1` FOREIGN KEY (`cirurgiao_id`) REFERENCES `administradores` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  234.   ADD CONSTRAINT `fk_contrato_orcamento1` FOREIGN KEY (`orcamento_id`) REFERENCES `orcamento` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  235.   ADD CONSTRAINT `fk_contrato_paciente1` FOREIGN KEY (`paciente_id`) REFERENCES `paciente` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
  236.  
  237. ALTER TABLE `execucao`
  238.   ADD CONSTRAINT `FK_139E7F7676323123` FOREIGN KEY (`atendimento_id`) REFERENCES `atendimento` (`id`),
  239.   ADD CONSTRAINT `FK_139E7F76957594D7` FOREIGN KEY (`implante_id`) REFERENCES `implante` (`id`),
  240.   ADD CONSTRAINT `fk_execucao_administradores1` FOREIGN KEY (`administradores_id`) REFERENCES `administradores` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  241.   ADD CONSTRAINT `fk_execucao_procedimento1` FOREIGN KEY (`procedimento_id`) REFERENCES `procedimento` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
  242.  
  243. ALTER TABLE `implante`
  244.   ADD CONSTRAINT `FK_A05F8138892D0ABB` FOREIGN KEY (`execucao_id`) REFERENCES `execucao` (`id`),
  245.   ADD CONSTRAINT `fk_implante_implante_marca1` FOREIGN KEY (`implante_marca_id`) REFERENCES `implante_marca` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  246.   ADD CONSTRAINT `fk_implante_implante_tipo1` FOREIGN KEY (`implante_tipo_id`) REFERENCES `implante_tipo` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
  247.  
  248. ALTER TABLE `orcamento`
  249.   ADD CONSTRAINT `fk_orcamento_pacientes` FOREIGN KEY (`paciente_id`) REFERENCES `paciente` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
  250.  
  251. ALTER TABLE `procedimento`
  252.   ADD CONSTRAINT `FK_CD974452A01CF1CA` FOREIGN KEY (`orcamento_id`) REFERENCES `orcamento` (`id`),
  253.   ADD CONSTRAINT `fk_procedimento_regiao_procedimento1` FOREIGN KEY (`regiao_procedimento_id`) REFERENCES `procedimento_regiao` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  254.   ADD CONSTRAINT `fk_procedimento_tipo_procedimento1` FOREIGN KEY (`tipo_procedimento_id`) REFERENCES `procedimento_tipo` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement