rdagumampan / yuniql

Free and open source schema versioning and database migration made natively with .NET/6. NEW THIS MAY 2022! v1.3.15 released!
https://yuniql.io
Apache License 2.0
417 stars 63 forks source link

__yuniql_schema_version schema mismatch #299

Open eduardo-aguilar opened 1 year ago

eduardo-aguilar commented 1 year ago

We're using YuniQL as our schema versioning and database migration engine for a Postgres DB. The issue we're seeing is the following:

Expected Behavior

YuniQL recognizes that new version of YuniQL has a different schema for the __yuniql_schema_version table and updates it.

Actual behavior

We continue having the same schema for the __yuniql_schema_version.

Is there a YuniQL way of solving this issue?

We continue having:

CREATE TABLE 
    __yuniql_schema_version 
    ( 
        sequence_id SMALLSERIAL NOT NULL, 
        VERSION        CHARACTER VARYING(512) NOT NULL, 
        applied_on_utc TIMESTAMP(6) WITHOUT TIME ZONE DEFAULT timezone('UTC'::TEXT, 
        CURRENT_TIMESTAMP) NOT NULL, 
        applied_by_user         CHARACTER VARYING(32) DEFAULT USER NOT NULL, 
        applied_by_tool         CHARACTER VARYING(32) NOT NULL, 
        applied_by_tool_version CHARACTER VARYING(16) NOT NULL, 
        status                  CHARACTER VARYING(32) NOT NULL, 
        duration_ms             INTEGER NOT NULL, 
        checksum                CHARACTER VARYING(64) NOT NULL, 
        failed_script_path      CHARACTER VARYING(4000), 
        failed_script_error     CHARACTER VARYING(4000), 
        additional_artifacts    CHARACTER VARYING(4000) 
    );

We want to have:

CREATE TABLE 
    __yuniql_schema_version 
    ( 
        sequence_id SMALLSERIAL NOT NULL, 
        VERSION        CHARACTER VARYING(512) NOT NULL, 
        applied_on_utc TIMESTAMP(6) WITHOUT TIME ZONE DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC' 
        ::TEXT) NOT NULL, 
        applied_by_user         CHARACTER VARYING(128) DEFAULT USER NOT NULL, 
        applied_by_tool         CHARACTER VARYING(32) NOT NULL, 
        applied_by_tool_version CHARACTER VARYING(16) NOT NULL, 
        status                  CHARACTER VARYING(32) NOT NULL, 
        duration_ms             INTEGER NOT NULL, 
        checksum                CHARACTER VARYING(64) NOT NULL, 
        failed_script_path      CHARACTER VARYING(4000), 
        failed_script_error     CHARACTER VARYING(4000), 
        additional_artifacts    CHARACTER VARYING(4000) 
    );
rdagumampan commented 1 year ago

@eduardo-aguilar thanks for reaching out and please excuse for long delay. Im not sure I complete follow the issue here. Those two versions of yuniql should have the same schema structure of the tracking table __yunisql_schema_version. This structure stands to last and I dont see any other changes to it in foreseable future.

Actually, the only time yuniql upgrades the schema of tracking table was when I dropped __yuniqldbversion and change into __yuniql_schema_version. HTH