mybatis / migrations

A command line Database migrations tool
http://mybatis.github.io/migrations
Apache License 2.0
214 stars 77 forks source link

migrate script output incomplete #134

Closed cvavala closed 6 years ago

cvavala commented 6 years ago
PS C:\Users\Cristiano\Projects\coco30\trunk\db\migrations> migrate status
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
------------------------------------------------------------------------
-- MyBatis Migrations - status
------------------------------------------------------------------------
ID             Applied At          Description
================================================================================
20180531095901 2018-05-31 18:27:13 create changelog
20180928154856 2018-09-28 16:43:23 modifica carichi piattaforma scheduler program
20181001111800    ...pending...    create user AV SMK FIX

------------------------------------------------------------------------
-- MyBatis Migrations SUCCESS
-- Total time: 8s
-- Finished at: Wed Oct 03 16:28:59 CEST 2018
-- Final Memory: 52M/479M
------------------------------------------------------------------------
PS C:\Users\Cristiano\Projects\coco30\trunk\db\migrations> type .\scripts\20181001111800_create_user_AV_SMK_FIX.sql
-- // CREATE USER AV_SMK_FIX
-- Migration SQL that makes the change goes here.

CREATE USER AV_SMK_FIX IDENTIFIED BY av_smk_fix;

GRANT SELECT ON cocone.TAB_TEMPO_TBL TO AV_SMK_FIX;
GRANT SELECT ON cocone.tab_divisioni_tbl TO AV_SMK_FIX;
GRANT SELECT ON cocone.tab_negozi_vw TO AV_SMK_FIX;
GRANT SELECT ON cocone.tab_clgest_vw TO AV_SMK_FIX;
GRANT SELECT ON cocone.tab_repgest_tbl TO AV_SMK_FIX;

CREATE SEQUENCE  AV_SMK_FIX.REP_AV  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 73545 CACHE 20 NOORDER  NOCYCLE ;

CREATE OR REPLACE VIEW AV_SMK_FIX.TEMPO_VW
(GIORNO,PROGR,GIORNOSETT,GIORNOLUNGO,SETTMESE,SETTIMANA,MESE,DES_MESE,TRIMESTRE,SEMESTRE,ANNO,FINEMESE,BIMESTRE,QUADRIMESTRE,ANNOSETT,SETTIMANA_AV)
AS
select cal_gio GIORNO
,cal_ann_gio PROGR
,to_number(to_char(cal_gio,'D')) GIORNOSETT
,to_char(cal_gio,'day','NLS_DATE_LANGUAGE = italian') GIORNOLUNGO
,cal_settmese SETTMESE
,mod(cal_set,cal_ann) SETTIMANA
,mod(cal_mes,cal_ann) MESE
,to_char(cal_gio,'Month','NLS_DATE_LANGUAGE = italian') DES_MESE
,to_number(substr(cal_tri,1,1)) TRIMESTRE
,to_number(substr(cal_sem,1,1)) SEMESTRE
,cal_ann ANNO
,cal_finemese FINEMESE
,cal_bim BIMESTRE
,cal_qua QUADRIMESTRE
,NULL ANNOSETT
,case when cal_ann = 2018 then MOD (CAL_SETT_AV, cal_ann) + 1 else MOD (CAL_SETT_AV, cal_ann) + 1 end SETTIMANA_AV
from cocone.tab_tempo_tbl;

  CREATE OR REPLACE FORCE VIEW AV_SMK_FIX.SIR_DIVISIONI_VW (SNE0_NEG, SNE0_CODCI, SNE0_DESC, SNE0_CAN, SNE0_PRO, SNE0_AZI, SNE0_RSH, SNE0_FLAG, SNE0_NMAX_LINEE, SNE0_NMAX_FASCE, SNE0_DESBREVE) AS
  select
DIVISIONE_SIC_OLD SNE0_NEG
,null SNE0_CODCI
,replace(DESCRIZ_OLD,'Canale ','') SNE0_DESC
,null SNE0_CAN
,null SNE0_PRO
,null SNE0_AZI
,null SNE0_RSH
,null SNE0_FLAG
,null SNE0_NMAX_LINEE
,null SNE0_NMAX_FASCE
,null SNE0_DESBREVE
from cocone.tab_divisioni_tbl;

  CREATE OR REPLACE FORCE VIEW AV_SMK_FIX.NEGOZI_ATTIVI_VW (NEG_DIVISIONE, NEG_CODICE, NEG_DESCRIZIONE, NEG_DESBREVE, NEG_INDIRIZZO, NEG_LOCALITA, NEG_CAP, NEG_PROVINCIA, NEG_STATO, NEG_INIZIO_ATT, NEG_FINE_ATT, AREA, CANALE, OMOGENEO) AS
  select NEG_DIVISIONE
,to_number(substr(cod_neg,3)) NEG_CODICE
,descrizione NEG_DESCRIZIONE
,desbreve NEG_DESBREVE
,indirizzo NEG_INDIRIZZO
,localita NEG_LOCALITA
,cap NEG_CAP
,provincia NEG_PROVINCIA
,STATO NEG_STATO
,INIZIO_ATT NEG_INIZIO_ATT
,FINE_ATT NEG_FINE_ATT
,capoarea AREA
,substr(CANALE,1,3) CANALE
,NULL OMOGENEO
from cocone.tab_negozi_vw
WHERE cod_neg <> 13000
AND cod_neg <> 13999
--AND divisione IN ('11', '13')
AND fine_att > ADD_MONTHS (TRUNC (SYSDATE), -36)
order by cod_neg;

  CREATE OR REPLACE FORCE VIEW AV_SMK_FIX.AMM_CLGEST_VW (UG, DES_UG, GESTORE, DES_GEST, LIV1, DES_LIV1, LIV2, DES_LIV2, REP_DISTR, DES_REP_DISTR, DATA_INVAL, FLG_RESA, AMM_PROGRE, FLG_STAMPA_VEN, AMM_DTULT, AMM_CODOPER, COD_DISTINTE, DES_COD_DISTINTE, AMM_MAX_ALQIVA, AMM_GENERICO, AMM_FLG_INV_VEN, DATA_FIVAL, LIV_NAZIONALE, DES_LIV_NAZIONALE) AS
  select cod_ug UG
,DES_UG
,repgest GESTORE
,des_repgest DES_GEST
,RAGGR_GEST LIV1
,DESCR_RAGGR DES_LIV1
,AREA_GEST LIV2
,DESCR_AREA DES_LIV2
,REP_DISTR
,DESCR_REPDISTR DES_REP_DISTR
,datini DATA_INVAL
,FLG_RESA
,progre AMM_PROGRE
,FLG_STAMPA_VEN
,AMM_DTULT
,AMM_CODOPER
,COD_DISTINTE
,DES_COD_DISTINTE
,AMM_MAX_ALQIVA
,AMM_GENERICO
,null AMM_FLG_INV_VEN
,datfin DATA_FIVAL
,NULL LIV_NAZIONALE
,NULL DES_LIV_NAZIONALE
from cocone.tab_clgest_vw;

  CREATE OR REPLACE FORCE VIEW AV_SMK_FIX.AMM_GESTORI (AMM_GESTORE, AMM_DESCRIZIONE, AMM_SEQUENZA, AMM_DESBREVE) AS
  select repgest AMM_GESTORE,
  des_repgest AMM_DESCRIZIONE,
  ordinamento AMM_SEQUENZA,
  desbreve AMM_DESBREVE
from cocone.tab_repgest_tbl;

-- //@UNDO
-- SQL to undo the change goes here.

DROP USER AV_SMK_FIX CASCADE;
PS C:\Users\Cristiano\Projects\coco30\trunk\db\migrations> migrate script 20180928154856 20181001111800
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
------------------------------------------------------------------------
-- MyBatis Migrations - script
------------------------------------------------------------------------
-- 20181001111800_create_user_AV_SMK_FIX.sql
-- // CREATE USER AV_SMK_FIX
-- Migration SQL that makes the change goes here.

CREATE USER AV_SMK_FIX IDENTIFIED BY av_smk_fix;

GRANT SELECT ON cocone.TAB_TEMPO_TBL TO AV_SMK_FIX;
GRANT SELECT ON cocone.tab_divisioni_tbl TO AV_SMK_FIX;
GRANT SELECT ON cocone.tab_negozi_vw TO AV_SMK_FIX;
GRANT SELECT ON cocone.tab_clgest_vw TO AV_SMK_FIX;
GRANT SELECT ON cocone.tab_repgest_tbl TO AV_SMK_FIX;

CREATE SEQUENCE  AV_SMK_FIX.REP_AV  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 73545 CACHE 20 NOORDER  NOCYCLE ;

CREATE OR REPLACE VIEW AV_SMK_FIX.TEMPO_VW
(GIORNO,PROGR,GIORNOSETT,GIORNOLUNGO,SETTMESE,SETTIMANA,MESE,DES_MESE,TRIMESTRE,SEMESTRE,ANNO,FINEMESE,BIMESTRE,QUADRIMESTRE,ANNOSETT,SETTIMANA_AV)
AS
select cal_gio GIORNO
,cal_ann_gio PROGR
,to_number(to_char(cal_gio,'D')) GIORNOSETT
,to_char(cal_gio,'day','NLS_DATE_LANGUAGE = italian') GIORNOLUNGO
,cal_settmese SETTMESE
,mod(cal_set,cal_ann) SETTIMANA
,mod(cal_mes,cal_ann) MESE

INSERT INTO CHANGELOG (ID, APPLIED_AT, DESCRIPTION) VALUES (20181001111800, '2018-10-03 16:42:21', 'create user AV SMK FIX');

------------------------------------------------------------------------
-- MyBatis Migrations SUCCESS
-- Total time: 0s
-- Finished at: Wed Oct 03 16:42:21 CEST 2018
-- Final Memory: 5M/479M
------------------------------------------------------------------------

PS C:\Users\Cristiano\Projects\coco30\trunk\db\migrations> migrate info
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
------------------------------------------------------------------------
-- MyBatis Migrations - info
------------------------------------------------------------------------
null 3.3.4 (null)
Java version: 1.8.0_172, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jre1.8.0_172
Default locale: en_US, platform encoding: Cp1252
OS name: "Windows 10", version: "10.0", arch: "amd64", family: "windows"
------------------------------------------------------------------------
-- MyBatis Migrations SUCCESS
-- Total time: 0s
-- Finished at: Wed Oct 03 16:36:07 CEST 2018
-- Final Memory: 5M/479M
------------------------------------------------------------------------
harawata commented 6 years ago

Seems like a duplicate of #121 . Could you try it with 3.3.5-SNAPSHOT? The bundle.zip is here.

cvavala commented 6 years ago

Yes, it works with 3.3.5-SNAPSHOT. Thanks