Requirements:
-
Oracle Database, see URLs liquibase.properties e.g.
jdbc:oracle:thin:@localhost:1521/localdb, with SYSDBA access -
create users LB_DEV and LB_TEST for development and test deployments, resp.
-- as SYSDBA CREATE USER lb_dev IDENTIFIED BY "liquibase"; GRANT CREATE SESSION, RESOURCE TO lb_dev; ALTER USER lb_dev QUOTA UNLIMITED ON users;
-
and repeat for user
lb_test-- as SYSDBA CREATE USER lb_test IDENTIFIED BY "liquibase"; GRANT CREATE SESSION, RESOURCE TO lb_test; ALTER USER lb_test QUOTA UNLIMITED ON users;
-
create schema
myschema1-- as SYSDBA CREATE USER myschema1 IDENTIFIED BY "top!secret"; GRANT CREATE SESSION, RESOURCE TO myschema1; ALTER USER myschema1 QUOTA UNLIMITED ON users;
-
run
liquibase update -
tables
DATABASECHANGELOGandDATABASECHANGELOGLOCKare created in schemaLB_DEV -
no changes in schema
myschema1as there is only empty SQL script in tables folder
- added script for table
table1 - only changeset 1 exists at the moment
- grant permissions to user
LB_DEVGRANT CREATE ANY TABLE to lb_dev; - run
liquibase update - table
TABLE1is created in schemaMYSCHEMA1
- add changeset2 to table
table1 - grant permissions to user
LB_DEVGRANT ALTER ANY TABLE to lb_dev; GRANT CREATE ANY INDEX to lb_dev;
- run
liquibase update - table
TABLE1is modified
- create script for view
view1 - grant permissions to user
LB_DEVGRANT CREATE ANY VIEW to lb_dev; - run
liquibase update - view
VIEW1is created
- change script for view
view1either increasing id or not - run
liquibase update - view
VIEW1is modified, runOnChange works as expected
- create table
TABLE2directly in schemamyschema1 - liquibase does not know about the new table, running
liquibase updatedoes not check for additional objects - but we want to include it in our repo
- add
CREATE TABLEscript for tabletable2into changesetinit:0 - running
liquibase updatefails withORA-00955: name is already used by an existing object, because it tries to recreate the table, that already exists - run
liquibase markNextChangeSetRan - the next run of
liquibase updatesucceeds - and we can continue now as with table that was created using liquibase, see changeset
sna:1
- liquibase user needs CREATE ANY PROCEDURE privilege for creating any packages, functions and procedures in other schemas
GRANT CREATE ANY procedure TO lb_dev;- adding new or existing packages/procedures/functions works the same way as for views