Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents


I have an existing Liquibase Enterprise / DaticalDB project that I want to duplicate and modify instead of creating a new one from scratch.

...

Info

Disclaimer: This is an advanced topic.

  • Do not attempt without full knowledge of how Datical works.
  • Talk to your Customer Success team if you need help.
  • This only works when cloning projects on the same database platform.

Step-by-step guide

For the purpose of this article, we will use the following naming conventions:

  • original project name: EPOD_CMS
  • new project name: Portal

SCM

The first thing to do is to create repositories for your new project and its associated SQL scripts.

  1. For the SQL script repository, simply refer to your Implementation Guide on setting up with your particular SCM (or co-locate in the existing developer application repository).
    1. Copy the sql script directory structure from the original repository.
    2. You might need to remove or at least validate the values in any existing metadata.properties files. 
    3. Be sure to note the last Commit ID (this will be used later in the deployPackager.properties file).
  2. For the Datical DB project, create an empty new repository. For this article, we will call the repository: portal_ddb.

Copy your old project

  1. Go to your workstation/client and checkout/pull the newly created new repo: portal_ddb.
  2. Copy the contents of the Datical project you want to clone into the new directory
    1. Remove any SCM administration folders like ".git/", ".svn/", etc.)
  3. Now let's modify some files.

Files to modify

.project

Replace the name of the project at the top of file from:

...

Code Block
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
  <name>Portal</name>

and save.

datical.project

Here you will have a little more editing to do depending on your use case:

  • Change the name on the first line to:
    name="Portal"
  • Remove the projectsId content from: 

    Code Block
    projectsId="ec91d5b7-bf95-4249-af7f-f06dde742cb9"

    to 

    Code Block
    projectsId=""


  • Edit your database connections by editing the matching DbDefs.
    • You will need to use the UI to enter a different password. If you do not have access to the UI, you can Base64 encode the password as the value in the datical.project.
    • You will need to change the managed database or schema(s) information in the new project.
    • Remove the projectsId any dbDefsId content from: 

      Code Block
      dbDefsId="3cc01c15-727a-34c1-ba97-5aafd139b839"

      to 

      Code Block
      dbDefsId=""


  • Edit your plans.
    • Remove the any plansId content from: 

      Code Block
      plansId="b5e83263-beff-3eb6-8f41-0d1881ee330e"

      to 

      Code Block
      plansId=""


...

Code Block
<?xml version="1.0" encoding="ASCII"?>
<dbproject:Project xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dbproject="http://datical.com/db/project/1.0" name="Portal" storedLogicExternal="true" deployThreshold="stopOnError" requireOptions="true" projectsId="" runtimeCredentials="false" multiSchema="true" dbSchemaDefinition="project" schemaSelectionStep="REF1" trackingSchema="DATICALDBTRACKING" enableRowCount="true">
  <dbDefs xsi:type="dbproject:OracleDbDef" name="REF1" driver="oracle.jdbc.OracleDriver" hostname="localhost" port="1521" username="DATICAL_USER" password="REFUSUNBTF9VU0VS" contexts="REF,REF1" storageOptionCollectedAtSnapshot="true" labels="current" dbDefsId="" serviceName="CMS_REF1" enableCompression="false" rowsPerBatch="10000"/>
  <dbDefs xsi:type="dbproject:OracleDbDef" name="REF2" driver="oracle.jdbc.OracleDriver" hostname="localhost" port="1521" username="DATICAL_USER" password="REFUSUNBTF9VU0VS" contexts="REF,REF2" storageOptionCollectedAtSnapshot="true" labels="next" dbDefsId="" serviceName="CMS_REF2" enableCompression="false" rowsPerBatch="10000"/>
  <dbDefs xsi:type="dbproject:OracleDbDef" name="DEVINT1" driver="oracle.jdbc.OracleDriver" hostname="localhost" port="1521" username="DATICAL_USER" password="REFUSUNBTF9VU0VS" contexts="DEV, DEVINT1" storageOptionCollectedAtSnapshot="true" labels="current" dbDefsId="" serviceName="CMS_INT1" enableCompression="false" rowsPerBatch="10000"/>
  <dbDefs xsi:type="dbproject:OracleDbDef" name="DEVINT2" driver="oracle.jdbc.OracleDriver" hostname="localhost" port="1521" username="DATICAL_USER" password="REFUSUNBTF9VU0VS" contexts="DEV, DEVINT2" storageOptionCollectedAtSnapshot="true" labels="next" dbDefsId="" serviceName="CMS_INT2" enableCompression="false" rowsPerBatch="10000"/>
  <dbDefs xsi:type="dbproject:OracleDbDef" name="QA" driver="oracle.jdbc.OracleDriver" hostname="localhost" port="1521" username="DATICAL_USER" password="REFUSUNBTF9VU0VS" contexts="QA" storageOptionCollectedAtSnapshot="true"  dbDefsId="" serviceName="CMS_QA" enableCompression="false" rowsPerBatch="10000"/>
  <dbDefs xsi:type="dbproject:OracleDbDef" name="PROD" driver="oracle.jdbc.OracleDriver" hostname="localhost" port="1521" username="DATICAL_USER" password="REFUSUNBTF9VU0VS" contexts="PROD" storageOptionCollectedAtSnapshot="true"  dbDefsId="" serviceName="CMS_PROD" enableCompression="false" rowsPerBatch="10000"/>
  <plans name="current" databaseDefs="//@dbDefs[name='REF1'] //@dbDefs[name='DEVINT1'] //@dbDefs[name='QA'] //@dbDefs[name='PROD']" plansId=""/>
  <plans name="next" databaseDefs="//@dbDefs[name='REF2'] //@dbDefs[name='DEVINT2'] //@dbDefs[name='QA'] //@dbDefs[name='PROD']" plansId=""/>
  <changelog href="Changelog/changelog.xml#//@databaseChangeLog"/>
  <dmcDB xsi:type="dbproject:PostgresqlDbDef" name="DMCDB" driver="org.postgresql.Driver" hostname="dmc-db.liquibase.net" port="5432" username="datical_user" password="ZGF3aWNhbF91c9Vy" dbDefType="dmcdb" database="cs_dmc"/>
  <releaseLabels name="current AND !abandoned" description="Deploy changesets from the current pipeline that have not been abandoned"/>
  <releaseLabels name="hotfix AND !abandoned" description="Deploy changesets from the hotfix pipeline that have not been abandoned"/>
  <schemas name="TRAINING"/>
  <schemas name="APP_SCHEMA"/>
</dbproject:Project>


Changelog/changelog.xml

Remove all the changesets and simply keep the first 2 lines and the last one. Your changelog.xml should match the following example:

Code Block
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:appdba="http://www.datical.net/xml/ns/appdba" xmlns:datical="http://www.datical.net/xml/ns/datical" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:storedlogic="http://www.datical.net/xml/ns/storedlogic" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" logicalFilePath="Changelog/changelog.xml" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
</databaseChangeLog>

deployPackager.properties

  1. Be sure to replace the scmLastImportID (you remembered to save it in step 1) for the main branch and all additional branches.
  2. Also don't forget to change the sqlScmPath as required for the path to the new Portal_SQL/sql_code repository

...

Code Block
sqlScmSystem=git
ddbScmSystem=git
databaseBackupRestoreLocation=
sqlScmLastImportID=b167ebdc209c90c7d2b97fb009fe9014a0457616
ddbScmPath=./
sqlScmPath=../portal_sql
sqlScmSQLBaseDir=sql_code

Directories and files to delete

The following directories can be deleted

...

You can also delete any log in the top level directory like daticaldb.log

Commit

You should now be able to commit your updated datical project to the new repository.

Final steps

GUI

Now open the Datical UI and import your project. If the system does not let you, it's certainly because one the files has an issue. Using an XML online validator can help to find some syntax issues. It could also be because you forget to update the ".project" file and the system detects a duplicate name for a project

  1. Check your connections
  2. Update your passwords as needed
  3. Register your project in your DMC DB
  4. Run a status

Filter by label (Content by label)
showLabelsfalse
max5
spacescom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@1ff1d7
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in ( "daticaldb" , "project" ) and type = "page" and space = "DDKB"
labelsproject daticaldb

...

hiddentrue

...