Files
jogos_matheus/patches/CLAUDE.md
T
2026-09-23 12:29:08 -03:00

2.0 KiB

Patches

Liquibase database migration changelogs. Two subdirectories — one per supported database:

patches/
  oracle/
    <timestamp>_<KEY>.xml
  postgresql/
    <timestamp>_<KEY>.xml

The filename convention is {YYYYMMDDHHmm}_{MODULE_KEY}.xml (e.g. 202604081221_GO.xml).

Both files must always be kept in sync — every changeset must appear in both.

Rules

  • Append-only. Never edit or delete existing <changeSet> entries. Liquibase tracks executed changesets by id + author; modifying them breaks the checksum and will fail deployment. You can change conditions and order tho.
  • Unique IDs. Each <changeSet id="..."> must have a unique numeric ID within the file. Increment from the last existing one.
  • Use preConditions. Wrap DDL in <preConditions onFail="MARK_RAN"> guards so the changelog is idempotent and safe to re-run.
  • Oracle vs PostgreSQL syntax differs. Sequences, data types, and quoting rules are different — write each file for its target DB. Don't copy-paste blindly between them.

File skeleton

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
  xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
                      http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">

  <changeSet author="your.name" id="401" objectQuotingStrategy="LEGACY">
    <preConditions onError="WARN" onFail="MARK_RAN" onSqlOutput="IGNORE">
      <not>
        <tableExists tableName="my_table" />
      </not>
    </preConditions>
    <sql endDelimiter=";" splitStatements="true" stripComments="false">
      CREATE TABLE my_table ( ... );
    </sql>
  </changeSet>

</databaseChangeLog>

vitruvio.json registration

"patches": [
  { "path": "patches" }
]