USE cofree;

CREATE TABLE ParecerPT (
  causa VARCHAR(25),
  atratividade VARCHAR(8),
  parecer VARCHAR(1250),
  PRIMARY KEY(causa) 
);

CREATE TABLE Licenca (
  nome VARCHAR(45),
  tipo VARCHAR(25),
  PRIMARY KEY(tipo)
);

CREATE TABLE Usuario (
  dataUso DATE NOT NULL,
  nomeProjeto CHAR NULL,
  idadeAno INTEGER UNSIGNED NULL,
  IdadeMes INTEGER UNSIGNED NULL,
  email CHAR NULL,
  IP CHAR NULL,
  PRIMARY KEY(dataUso)
);

CREATE TABLE TipoProjeto (
  dataUso DATE NOT NULL,
  Usuario_dataUso DATE NOT NULL,
  comunic BOOL NOT NULL,
  bd BOOL NULL,
  desktop BOOL NULL,
  educac BOOL NULL,
  jogos BOOL NULL,
  internet BOOL NULL,
  mmidia BOOL NULL,
  escrit BOOL NULL,
  swDesenv BOOL NULL,
  impress BOOL NULL,
  religiao BOOL NULL,
  seguranca BOOL NULL,
  sociologia BOOL NULL,
  terminal BOOL NULL,
  sistema BOOL NULL,
  editortxt BOOL NULL,
  outro BOOL NULL,
  PRIMARY KEY(dataUso),
  INDEX TipoProjeto_FKIndex1(Usuario_dataUso),
  FOREIGN KEY(Usuario_dataUso)
    REFERENCES Usuario(dataUso)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION
);

CREATE TABLE TipoLicenca (
  dataUso DATE NOT NULL,
  Usuario_dataUso DATE NOT NULL,
  licGnugpl BOOL NULL,
  licApplepsl BOOL NULL,
  licCommonpl BOOL NULL,
  licEiffelfl BOOL NULL,
  licLessergp BOOL NULL,
  licIbmpl BOOL NULL,
  licJabberosl BOOL NULL,
  licMotosotol BOOL NULL,
  licMozillapl10 BOOL NULL,
  licMozillapl11 BOOL NULL,
  licNethackgpl BOOL NULL,
  licNokiaosl BOOL NULL,
  licQtpl BOOL NULL,
  licRicohscpl BOOL NULL,
  licSleepycatl BOOL NULL,
  licSunpl BOOL NULL,
  licApachesl BOOL NULL,
  licArtisticl BOOL NULL,
  licBsdl BOOL NULL,
  licIntelosl BOOL NULL,
  licMitl BOOL NULL,
  licOpengrouptsl BOOL NULL,
  licPublicd BOOL NULL,
  licPythonl BOOL NULL,
  licPythonsfl BOOL NULL,
  licSunissl BOOL NULL,
  licUillinois BOOL NULL,
  licVovidasl BOOL NULL,
  licW3cl BOOL NULL,
  licXnetl BOOL NULL,
  licZlibl BOOL NULL,
  licZopepl BOOL NULL,
  PRIMARY KEY(dataUso),
  INDEX licenca_FKIndex1(Usuario_dataUso),
  FOREIGN KEY(Usuario_dataUso)
    REFERENCES Usuario(dataUso)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION
);

CREATE TABLE CicloVida (
  dataUso DATE NOT NULL,
  Usuario_dataUso DATE NOT NULL,
  planej BOOL NULL,
  preAlfa BOOL NULL,
  alfa BOOL NULL,
  beta BOOL NULL,
  producao BOOL NULL,
  maduro BOOL NULL,
  PRIMARY KEY(dataUso),
  INDEX CicloVida_FKIndex1(Usuario_dataUso),
  FOREIGN KEY(Usuario_dataUso)
    REFERENCES Usuario(dataUso)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION
);

CREATE TABLE PublicoAlvo (
  dataUso DATE NOT NULL,
  Usuario_dataUso DATE NOT NULL,
  usuarioFinal BOOL NULL,
  desenvolvedor BOOL NULL,
  admSistema BOOL NULL,
  usuarioFAvanc BOOL NULL,
  outro BOOL NULL,
  PRIMARY KEY(dataUso),
  INDEX PublicoAlvo_FKIndex1(Usuario_dataUso),
  FOREIGN KEY(Usuario_dataUso)
    REFERENCES Usuario(dataUso)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION
);


