-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreateDDL_ddlGeneration.jdbc
10 lines (10 loc) · 1.81 KB
/
createDDL_ddlGeneration.jdbc
1
2
3
4
5
6
7
8
9
10
CREATE TABLE dbo.PAN_METAS_ANUAIS (id NUMERIC(19) IDENTITY NOT NULL, ano INTEGER NOT NULL, clientes NUMERIC(19) NULL, codLoja INTEGER NOT NULL, updated DATETIME2 NULL, userLogin VARCHAR(100) NULL, valor NUMERIC(18,2) NOT NULL, PRIMARY KEY (id))
CREATE TABLE dbo.PAN_METAS_DIARIAS (id NUMERIC(19) IDENTITY NOT NULL, clientes NUMERIC(19) NULL, codLoja INTEGER NULL, dia DATETIME2 NOT NULL, proporcao NUMERIC(5,2) NULL, proporcaoClientes NUMERIC(5,2) NULL, updated DATETIME2 NULL, userLogin VARCHAR(100) NULL, valorConsolidado NUMERIC(28) NULL, PRIMARY KEY (id))
CREATE TABLE dbo.FILIAL (CODIGO_FIL VARCHAR(255) NOT NULL, BAND_FIL VARCHAR(255) NOT NULL, NOME_FIL VARCHAR(255) NOT NULL, SIGLA_FIL VARCHAR(255) NOT NULL, PRIMARY KEY (CODIGO_FIL))
CREATE TABLE dbo.PAN_METAS_CATEGORIAS (id NUMERIC(19) IDENTITY NOT NULL, codCategoria VARCHAR(18) NOT NULL, codLoja INTEGER NOT NULL, dia DATETIME2 NOT NULL, updated DATETIME2 NULL, userLogin VARCHAR(100) NULL, valor NUMERIC(28) NOT NULL, PRIMARY KEY (id))
CREATE TABLE dbo.PAN_USERS (id NUMERIC(19) IDENTITY NOT NULL, codLoja INTEGER NULL, email VARCHAR(120) NOT NULL, login VARCHAR(30) NULL UNIQUE, nome VARCHAR(60) NULL, perfil VARCHAR(30) NULL, PRIMARY KEY (id))
CREATE TABLE dbo.PAN_METAS_MENSAIS (id NUMERIC(19) IDENTITY NOT NULL, ano INTEGER NOT NULL, clientes NUMERIC(19) NULL, codLoja INTEGER NOT NULL, mes INTEGER NOT NULL, updated DATETIME2 NULL, userLogin VARCHAR(100) NULL, valor NUMERIC(18,2) NOT NULL, PRIMARY KEY (id))
ALTER TABLE dbo.PAN_METAS_ANUAIS ADD CONSTRAINT UNQ_PAN_METAS_ANUAIS_0 UNIQUE (ano, codLoja)
ALTER TABLE dbo.PAN_METAS_DIARIAS ADD CONSTRAINT uc_meta_diaria UNIQUE (codLoja, dia)
ALTER TABLE dbo.PAN_METAS_CATEGORIAS ADD CONSTRAINT uc_meta_categoria UNIQUE (codLoja, codCategoria, dia)
ALTER TABLE dbo.PAN_METAS_MENSAIS ADD CONSTRAINT PAN_METAS_MENSAIS0 UNIQUE (ano, mes, codLoja)