-- Script per le modifiche al DB relative alla funzionalita Donor SMS Retention CO(Kit Ottobre 2005) 
-- Ambra Parati


-- Tabella MNP_SMS_L1 

CREATE TABLE MNP_SMS_L1
    (id_prog                        NUMBER(18,0) NOT NULL,
    id_richiesta                   VARCHAR2(23) NOT NULL,
    msisdn                         VARCHAR2(15) NOT NULL,    
    codice_pre_post_pagato	   VARCHAR2(3)DEFAULT 'POP',
    da_inviare                     NUMBER(1,0) DEFAULT 1 NOT NULL,
    nome_file                      VARCHAR2(40),
    data_creazione                 DATE DEFAULT SYSDATE)
  PCTFREE     10
  PCTUSED     40
  INITRANS    1
  MAXTRANS    255
  TABLESPACE  TAB_MEDIUM
  STORAGE   (
    INITIAL     100K
    NEXT        100K
    PCTINCREASE 1
    MINEXTENTS 1
    MAXEXTENTS  512
  )
/
ALTER TABLE MNP_SMS_L1
ADD CONSTRAINT pk_mnp_sms_l1 PRIMARY KEY (id_prog)
USING INDEX
  PCTFREE     10
  INITRANS    2
  MAXTRANS    255
  TABLESPACE  TAB_MEDIUM
  STORAGE   (
     INITIAL     100K
     NEXT        100K
    PCTINCREASE 1
    MINEXTENTS  1
    MAXEXTENTS  512
  )
/
CREATE SEQUENCE seq_sms_l1
  INCREMENT BY 1
  START WITH 1
  MINVALUE 1
  MAXVALUE 999999999999999999999999999
  NOCYCLE
  NOORDER
  CACHE 20
/
-- Tabella MNP_FLUSSO_DEST

CREATE TABLE MNP_FLUSSO_DEST
    (id_prog                        NUMBER(18,0) NOT NULL,
    nome_file                      VARCHAR2(40),
    tipo_flusso			   NUMBER(2),
    destinatario		   VARCHAR2(10),
    data_invio		           DATE)
  PCTFREE     10
  PCTUSED     40
  INITRANS    1
  MAXTRANS    255
  TABLESPACE  TAB_SMALL
  STORAGE   (
    INITIAL     100K
    NEXT        100K
    PCTINCREASE 1
    MINEXTENTS 1
    MAXEXTENTS  512
  )
/
ALTER TABLE MNP_FLUSSO_DEST
ADD CONSTRAINT pk_mnp_flusso_dest PRIMARY KEY (id_prog)
USING INDEX
  PCTFREE     10
  INITRANS    2
  MAXTRANS    255
  TABLESPACE  TAB_SMALL
  STORAGE   (
     INITIAL     100K
     NEXT        100K
    PCTINCREASE 1
    MINEXTENTS  1
    MAXEXTENTS  512
  )
/
CREATE SEQUENCE seq_flusso_dest
  INCREMENT BY 1
  START WITH 1
  MINVALUE 1
  MAXVALUE 999999999999999999999999999
  NOCYCLE
  NOORDER
  CACHE 20
/


-- Tabella MNP_SMS_L1V

CREATE TABLE MNP_SMS_L1V
    (id_prog                        NUMBER(18,0) NOT NULL,
    id_richiesta                   VARCHAR2(23) NOT NULL,
    msisdn                         VARCHAR2(15) NOT NULL,  
    tipo_attivita                  VARCHAR2(1) NOT NULL,
    data_cut_over        	   DATE,
    da_inviare                     NUMBER(1,0) DEFAULT 1 NOT NULL,
    nome_file                      VARCHAR2(40),
    data_creazione                 DATE DEFAULT SYSDATE)
  PCTFREE     10
  PCTUSED     40
  INITRANS    1
  MAXTRANS    255
  TABLESPACE  TAB_MEDIUM
  STORAGE   (
    INITIAL     100K
    NEXT        100K
    PCTINCREASE 1
    MINEXTENTS 1
    MAXEXTENTS  512
  )
/
ALTER TABLE MNP_SMS_L1V
ADD CONSTRAINT pk_mnp_sms_l1v PRIMARY KEY (id_prog)
USING INDEX
  PCTFREE     10
  INITRANS    2
  MAXTRANS    255
  TABLESPACE  TAB_MEDIUM
  STORAGE   (
     INITIAL     100K
     NEXT        100K
    PCTINCREASE 1
    MINEXTENTS  1
    MAXEXTENTS  512
  )
/
CREATE SEQUENCE seq_sms_l1v
  INCREMENT BY 1
  START WITH 1
  MINVALUE 1
  MAXVALUE 999999999999999999999999999
  NOCYCLE
  NOORDER
  CACHE 20
/

----------------------------------------------
-------------LOG SMS RETENTION----------------
----------------------------------------------

-- INSERT mnp_anagrafica_processo
INSERT INTO mnp_anagrafica_processo
(CODICE_PROCESSO,NOME_PROCESSO)
VALUES 
('OA','SmsRetentionOut')
/
INSERT INTO mnp_anagrafica_log
(CODICE_LOG,SEVERITA,DESCRIZIONE)
VALUES
('8900','N','CREAZIONE DEL FILE DI SMS RETENTION')
/
INSERT INTO mnp_anagrafica_log
(CODICE_LOG,SEVERITA,DESCRIZIONE)
VALUES
('8901','C','ERRORE NELLA CREAZIONE DEL FILE DI SMS RETENTION')
/
INSERT INTO mnp_processo_log
(CODICE_PROCESSO,CODICE_LOG,LOG_ON)
VALUES 
('OA','8900',1)
/
INSERT INTO mnp_processo_log
(CODICE_PROCESSO,CODICE_LOG,LOG_ON)
VALUES 
('OA','8901',1)
/
INSERT INTO mnp_processo_log
(CODICE_PROCESSO,CODICE_LOG,LOG_ON)
VALUES 
('OA','0001',1)
/
INSERT INTO mnp_processo_log
(CODICE_PROCESSO,CODICE_LOG,LOG_ON)
VALUES 
('OA','0002',1)
/
INSERT INTO mnp_processo_log
(CODICE_PROCESSO,CODICE_LOG,LOG_ON)
VALUES 
('OA','0003',1)
/
INSERT INTO mnp_processo_log
(CODICE_PROCESSO,CODICE_LOG,LOG_ON)
VALUES 
('OA','0000',1)
/
INSERT INTO mnp_processo_log
(CODICE_PROCESSO,CODICE_LOG,LOG_ON)
VALUES 
('OA','9999',1)
/
INSERT INTO mnp_processo_log
(CODICE_PROCESSO,CODICE_LOG,LOG_ON)
VALUES 
('OA','0005',1)
/
INSERT INTO mnp_processo_log
(CODICE_PROCESSO,CODICE_LOG,LOG_ON)
VALUES 
('OA','0007',1)
/
commit
/