CREATE TABLE link (
  cod_link int(11) NOT NULL auto_increment,
  titulo varchar(255) default NULL,
  url varchar(255) default NULL,
  descricao varchar(255) default NULL,
  cod_categoria int(11) default NULL,
  ctr_dth_inc datetime default NULL,
  ctr_dth_atu datetime default NULL,
  ctr_usu_inc int(10) unsigned default NULL,
  ctr_usu_atu int(10) unsigned default NULL,
  ctr_ip_inc varchar(20) default NULL,
  ctr_ip_atu varchar(20) default NULL,
  PRIMARY KEY  (cod_link)
)

CREATE TABLE link_categoria (
  cod_categoria int(11) NOT NULL auto_increment,
  categoria varchar(255) default NULL,
  ctr_dth_inc datetime default NULL,
  ctr_dth_atu datetime default NULL,
  ctr_usu_inc int(10) unsigned default NULL,
  ctr_usu_atu int(10) unsigned default NULL,
  ctr_ip_inc varchar(20) default NULL,
  ctr_ip_atu varchar(20) default NULL,
  PRIMARY KEY  (cod_categoria)
)

CREATE TABLE noticia (
  cod_noticia int(10) unsigned NOT NULL auto_increment,
  titulo varchar(255) default NULL,
  texto text,
  imagem varchar(255) default NULL,
  publicado int(1) unsigned NOT NULL default '0',
  dth_noticia datetime default NULL,
  fonte varchar(255) default NULL,
  link_fonte varchar(255) default NULL,
  legenda varchar(255) default NULL,
  dth_publicacao datetime default NULL,
  dth_retirada datetime default NULL,
  ctr_dth_inc datetime default NULL,
  ctr_dth_atu datetime default NULL,
  ctr_usu_inc int(10) unsigned default NULL,
  ctr_usu_atu int(10) unsigned default NULL,
  ctr_ip_inc varchar(20) default NULL,
  ctr_ip_atu varchar(20) default NULL,
  PRIMARY KEY  (cod_noticia)
)

CREATE TABLE usuario (
  cod_usuario int(10) unsigned NOT NULL auto_increment,
  nome varchar(255) default NULL,
  usuario varchar(255) default NULL,
  email varchar(255) default NULL,
  senha varchar(255) default NULL,
  nivel_acesso int(10) unsigned default NULL,
  ctr_dth_inc datetime default NULL,
  ctr_dth_atu datetime default NULL,
  ctr_usu_inc int(10) unsigned default NULL,
  ctr_usu_atu int(10) unsigned default NULL,
  ctr_ip_inc varchar(20) default NULL,
  ctr_ip_atu varchar(20) default NULL,
  PRIMARY KEY  (cod_usuario),
  UNIQUE KEY usuario (usuario)
)

CREATE TABLE usuario_nivel (
  cod_nivel int(11) NOT NULL default '0',
  nivel varchar(255) default NULL,
  ctr_dth_inc datetime default NULL,
  ctr_dth_atu datetime default NULL,
  ctr_usu_inc int(10) unsigned default NULL,
  ctr_usu_atu int(10) unsigned default NULL,
  ctr_ip_inc varchar(20) default NULL,
  ctr_ip_atu varchar(20) default NULL,
  PRIMARY KEY  (cod_nivel)
)
