Login   Register  
PHP Classes
elePHPant
Icontem

File: mysql.sql

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Marcelo Costa  >  OOE  >  mysql.sql  >  Download  
File: mysql.sql
Role: Auxiliary data
Content type: text/plain
Description: mysql table script generator
Class: OOE
Web development application framework
Author: By
Last change: add log register table script
Date: 2008-08-19 13:11
Size: 2,575 bytes
 

Contents

Class file image Download
-- MYSQL

CREATE TABLE IF NOT EXISTS `acs_exception` (
  `CD_EXCEPTION` smallint(5) unsigned NOT NULL,
  `DS_EXCEPTION` varchar(128) NOT NULL,
  PRIMARY KEY  (`CD_EXCEPTION`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

INSERT INTO `acs_exception` (`CD_EXCEPTION`, `DS_EXCEPTION`) VALUES
(4001, 'Chave de autenticaçăo inválida'),
(4002, 'Login Inválido'),
(4003, 'Usuário Inativo'),
(4004, 'Número de tentativas excedido'),
(4005, 'Senha Inválida'),
(4006, 'Desconectado por Inatividade'),
(4007, 'Usuário sem permissőes'),
(4008, 'Usuário sem estabelecimento definido'),
(9000, 'Usuário logado tentou acessar página sem permissăo'),
(9001, 'Usuário fez logoff'),
(9999, 'Tentativa de acesso de usuário desconhecido');

CREATE TABLE IF NOT EXISTS `acs_sessao` (
  `ID_SESSION` int(10) unsigned NOT NULL auto_increment,
  `REMOTE_ADDR` bigint(20) unsigned NOT NULL,
  `KEYTIME` int(10) unsigned NOT NULL,
  `KEEPALIVE` int(10) unsigned NOT NULL,
  PRIMARY KEY  (`ID_SESSION`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 COMMENT='Controle da Sessăo de Login' AUTO_INCREMENT=1 ;


CREATE TABLE IF NOT EXISTS `acs_usuarios_login` (
  `CD_USUARIO` smallint(5) unsigned NOT NULL auto_increment,
  `TX_LOGIN` varchar(20) NOT NULL,
  `TX_SENHA_MD5` varchar(32) NOT NULL,
  `TX_SENHA_SHA1` varchar(40) NOT NULL,
  `QT_ACESSOS` smallint(5) unsigned NOT NULL,
  `QT_TENTATIVAS` tinyint(3) unsigned NOT NULL,
  `DT_TROCA_SENHA` timestamp NOT NULL default '0000-00-00 00:00:00',
  `DT_ULT_ACESSO` timestamp NULL default NULL,
  `DT_ACESSO` timestamp NULL default NULL,
  `TX_IP` varchar(15) default NULL,
  `ST_REG` enum('A','I') NOT NULL,
  PRIMARY KEY  (`CD_USUARIO`),
  UNIQUE KEY `UK_USU_LOGIN_01` (`TX_LOGIN`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 COMMENT='Dados para Login do Usuário' AUTO_INCREMENT=1 ;



CREATE TABLE IF NOT EXISTS `acs_usuarios` (
  `CD_USUARIO` smallint(5) unsigned NOT NULL,
  `NM_USUARIO` varchar(50) NOT NULL,
  `TX_EMAIL` varchar(60) default NULL,
  `DT_INC` timestamp NOT NULL default CURRENT_TIMESTAMP,
  `DT_ALT` timestamp NULL default NULL,
  PRIMARY KEY  (`CD_USUARIO`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Cadastro de Usuários do Sistema';


CREATE TABLE IF NOT EXISTS `acs_log_acesso` (
  `DT_ACESSO` timestamp NOT NULL default CURRENT_TIMESTAMP,
  `TX_IP` varchar(15) NOT NULL,
  `CD_USUARIO` smallint(5) unsigned NOT NULL,
  `CD_EXCEPTION` smallint(6) default NULL,
  `IN_AUT_OK` enum('S','N') NOT NULL,
  PRIMARY KEY  (`DT_ACESSO`,`TX_IP`,`CD_USUARIO`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Log dos acessos dos Usuários do sistema';