I have an existing DaticalDB project that I want to duplicate and modify instead of creating a new one from scratch.
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.
- 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).
- Copy the sql script directory structure from the original repository.
- You might need to remove or at least validate the values in any existing metadata.properties files.
- Be sure to note the last Commit ID (this will be used later in the deployPackager.properties file).
- For the Datical DB project, create an empty new repository. For this article, we will call the repository: portal_ddb.
Copy your old project
- Go to your workstation/client and checkout/pull the newly created new repo: portal_ddb.
- Copy the contents of the Datical project you want to clone into the new directory
- Remove any SCM administration folders like ".git/", ".svn/", etc.)
- Now let's modify some files.
Files to modify
.project
Replace the name of the project at the top of file from:
<?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>EPOD_CMS</name>
to
<?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"
- If you have registered your old project to a DMC DB (newer) or an AuditDB (older), remove the projectsId entry such as:
projectsId="ec91d5b7-bf95-4249-af7f-f06dde742cb9"
- Edit your database connections by editing the matching DbDefs.
- You will need to use the UI to enter a different password.
- You will need to change the managed database or schema(s) information in the new project.
- Be sure to edit your "changelog" tag to remove any reference to the original project name. Alternatively, you can simplify it to:
<changelog href="Changelog/changelog.xml#//@databaseChangeLog"/>
Your file should look like
<?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" 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="REF1" storageOptionCollectedAtSnapshot="true" labels="current" 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="REF2" storageOptionCollectedAtSnapshot="true" labels="current" 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="DEVINT1, DEVINT" storageOptionCollectedAtSnapshot="true" environment="DEV" 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="DEVINT2, DEVINT" storageOptionCollectedAtSnapshot="true" labels="current" 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" labels="current" 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" labels="current" serviceName="CMS_PROD" enableCompression="false" rowsPerBatch="10000"/> <plans name="current" databaseDefs="//@dbDefs[name='REF1'] //@dbDefs[name='DEVINT1'] //@dbDefs[name='QA'] //@dbDefs[name='PROD']"/> <plans name="current" databaseDefs="//@dbDefs[name='REF2'] //@dbDefs[name='DEVINT2'] //@dbDefs[name='QA'] //@dbDefs[name='PROD']"/> <changelog href="Changelog/changelog.xml#//@databaseChangeLog"/> <releaseLabels name="current AND !abandoned" description="Deploy changesets from the current pipeline that have not been abandoned"/> <releaseLabels name="hotfix AND !abandoned" description="Deploy changeset 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:
<?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
- Be sure to replace the scmLastImportID (you remembered to save it in step 1) for the main branch and all additional branches.
- Also don't forget to change the sqlScmPath as required for the path to the new Portal_SQL/sql_code repository
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
- Logs
- Reports
- Snapshots
- Profiles
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
- Check your connections
- Update your passwords as needed
- Register your project in your DMC DB (newer) or your AuditDB (older)
- Run a status
Related articles