What is the difference between "ddl" and "sql_direct"/"ddl_direct" folders?

When using these packaging folders, the sql scripts are moved into the "archive" folder near the end of a successful packaging job.


Scripts in “DDL”:

Each script in “ddl” directory (when using the "convert" packaging method that is the default for the ddl folder) goes through a process during packaging called “convert SQL”. The output of the “convert SQL” is XML changeset that defines EVERY change of the object derived from a script. The benefit of “convert SQL” is that Datical can forecast these changes during forecast operation. Here is what a “convert SQL” generated changeset would look like. Notice that we identify creation of the table along with each column in the table.


changelog.xml (ddl)
    <changeSet appdba:scriptChecksum="10465378bdaf34aa6c432f0971dff485" author="jenkins (generated)" context="REF1, DEV, TEST, PROD" created="2018-07-02 14:34+0000" datical:origFileName="createAAA_TESTA1_new.sql" datical:origFilePath="ddl/NGT" datical:version="1" datical:versionStrategy="DEPLOY_ALL" id="7opf-1 (createTable tableName=AAA_TESTA1)" labels="sid-9090, 22, ddl, createaaa_testa1_new.sql" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
        <createTable schemaName="NGT" tableName="AAA_TESTA1">
            <column name="ID" type="NUMBER(*, 0)"/>
            <column name="FIRST_NAME" type="VARCHAR2(50 BYTE)"/>
            <column name="MIDDLE_NAME" type="VARCHAR2(50 BYTE)"/>
            <column name="LAST_NAME" type="VARCHAR2(50 BYTE)"/>
            <appdba:storageOptions dbms="oracle" path="ngt/storage/AAA_TESTA1_tbl_1530542040659.sql"/>
        </createTable>
    </changeSet>


Scripts in “SQL_DIRECT” or "DDL_DIRECT":

On the other hand, scripts in “sql_direct” and "ddl_direct" folders (and scripts in any folders using the "direct" or "ddl_direct" packaging methods receive a very different treatment. Datical does not perform “convert SQL” operation on these scripts and as such the XML changeset simply references the SQL script instead of exact changes to the database. The downside here is that Datical is unable to forecast changes from scripts in “sql_direct” folder. Here is what a “sql_direct” generated changeset would look like. Notice that XML simply references the script (see 'path="sql/2018080814545272_createAAA_TESTA6.sql" ') which is available to the changelog.xml via “resources” folder of the Datical project.


changelog.xml (sql_direct)
    <changeSet appdba:scriptChecksum="50be173164ac75b6500a2ff963636a67" author="Adeel Malik" context="REF1, DEV, TEST, PROD" created="2018-08-08 14:54+0000" datical:origFileName="createAAA_TESTA6.sql" datical:origFilePath="sql_direct/NGT" datical:version="1" datical:versionStrategy="DEPLOY_ALL" id="2018080814545272_createAAA_TESTA6" labels="58,$all,createAAA_TESTA6.sql">
        <appdba:sqlplus enableRollbackOnError="true" path="sql/2018080814545272_createAAA_TESTA6.sql" removeSpools="First" schemaName="NGT"/>
        <comment>script6</comment>
    </changeSet>


Related topics:

How To: Choose Between CONVERT (ddl) and DDL_DIRECT (ddl_direct) Packaging Methods

Writing SQL Scripts for Liquibase Enterprise#CONVERT/ddlfolderversusDIRECT/sql_directfolder

Overview of Packaging

Fixed Folder Names#ProcessingChanges

Flexible Folder Names#ComplexandInterdependentDatabaseChanges


Copyright © Datical 2012-2020 - Proprietary and Confidential