Skip to content

Commit

Permalink
fix: Update default charset and collation for mysql - EXO-75202
Browse files Browse the repository at this point in the history
With mysql 8.4, the default charset and collation are updated from UTF to UTF8MB4. In addition NVARCHAR is now deprecated and replaced by VARCHAR.
This commit adapt liquibase changes in order to apply this change.

Resolves Meeds-io/meeds#2564
  • Loading branch information
rdenarie committed Nov 7, 2024
1 parent 6b3b4b8 commit 92471b0
Show file tree
Hide file tree
Showing 3 changed files with 219 additions and 113 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@
</changeSet>

<changeSet author="links" id="1.0.0-1">
<validCheckSum>9:2bf1a89fd64c5ddbcbb9a7ec7f39bb9a</validCheckSum>
<validCheckSum>9:ab738a13c8adf9c2b302069a62039fa9</validCheckSum>
<createTable tableName="SOC_LINK_SETTINGS">
<column name="LINK_SETTING_ID" type="BIGINT" autoIncrement="${autoIncrement}" startWith="1">
<constraints nullable="false" primaryKey="true" primaryKeyName="PK_SOC_LINK_SETTINGS" />
</column>
<column name="NAME" type="NVARCHAR(255)">
<column name="NAME" type="VARCHAR(255)">
<constraints nullable="false" unique="true" uniqueConstraintName="UK_SOC_LINK_SETTINGS_NAME" />
</column>
<column name="PAGE_REFERENCE" type="NVARCHAR(500)">
<column name="PAGE_REFERENCE" type="VARCHAR(500)">
<constraints nullable="false" />
</column>
<column name="TYPE" type="BIGINT" defaultValueNumeric="0">
Expand All @@ -53,37 +55,39 @@
<column name="LARGE_ICON" type="BOOLEAN" defaultValueBoolean="false" />
<column name="SHOW_NAME" type="BOOLEAN" defaultValueBoolean="false" />
<column name="SHOW_DESCRIPTION" type="BOOLEAN" defaultValueBoolean="false" />
<column name="SEE_MORE_URL" type="NVARCHAR(2000)" />
<column name="SEE_MORE_URL" type="VARCHAR(2000)" />
<column name="LAST_MODIFIED" type="TIMESTAMP" defaultValueDate="${now}">
<constraints nullable="false" />
</column>
</createTable>
<modifySql dbms="mysql">
<append value=" ENGINE=INNODB CHARSET=UTF8 COLLATE utf8_unicode_ci" />
<append value=" ENGINE=INNODB CHARSET=UTF8MB4 COLLATE utf8mb4_0900_ai_ci" />
</modifySql>
</changeSet>

<changeSet author="links" id="1.0.0-2">
<validCheckSum>9:76f551e664fd3aecc6bd90d92eda206f</validCheckSum>
<validCheckSum>9:44402886b9d326ca695631cf320f78eb</validCheckSum>
<createTable tableName="SOC_LINKS">
<column name="LINK_ID" type="BIGINT" autoIncrement="${autoIncrement}" startWith="1">
<constraints nullable="false" primaryKey="true" primaryKeyName="PK_SOC_LINKS" />
</column>
<column name="LINK_SETTING_ID" type="BIGINT">
<constraints foreignKeyName="FK_SOC_LINKS_SOC_LINK_SETTINGS" references="SOC_LINK_SETTINGS(LINK_SETTING_ID)" deferrable="false" initiallyDeferred="false" deleteCascade="true" />
</column>
<column name="URL" type="NVARCHAR(2000)" />
<column name="URL" type="VARCHAR(2000)" />
<column name="SAME_TAB" type="BOOLEAN" defaultValueBoolean="false" />
<column name="LINK_ORDER" type="INT" defaultValueNumeric="0" />
<column name="ICON_FILE_ID" type="BIGINT" defaultValueNumeric="0" />
</createTable>
<modifySql dbms="mysql">
<append value=" ENGINE=INNODB CHARSET=UTF8 COLLATE utf8_unicode_ci" />
<append value=" ENGINE=INNODB CHARSET=UTF8MB4 COLLATE utf8mb4_0900_ai_ci" />
</modifySql>
</changeSet>

<changeSet author="links" id="1.0.0-3">
<createIndex tableName="SOC_LINK_SETTINGS" indexName="IDX_SOC_LINK_SETTINGS_01">
<column name="NAME" type="NVARCHAR(255)"></column>
<column name="NAME" type="VARCHAR(255)"></column>
</createIndex>
<createIndex tableName="SOC_LINKS" indexName="IDX_SOC_LINKS_01">
<column name="LINK_SETTING_ID" type="BIGINT"></column>
Expand All @@ -96,4 +100,10 @@
<createSequence sequenceName="SEQ_SOC_LINK_SETTINGS_ID" startValue="1" incrementBy="1" />
</changeSet>

</databaseChangeLog>
<changeSet author="links" id="1.0.0-5">
<sql dbms="mysql">
ALTER TABLE SOC_LINK_SETTINGS CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
ALTER TABLE SOC_LINKS CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
</sql>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@
</changeSet>

<changeSet author="metadata" id="1.0.0-1">
<validCheckSum>9:0a2f337dc523486dd5e7ce4831b21657</validCheckSum>
<validCheckSum>9:971c4c0f2b65199e18a17b4be24f6c56</validCheckSum>
<createTable tableName="SOC_METADATAS">
<column name="METADATA_ID" type="BIGINT" autoIncrement="${autoIncrement}" startWith="1">
<constraints nullable="false" primaryKey="true" primaryKeyName="PK_SOC_METADATAS" />
</column>
<column name="TYPE" type="BIGINT">
<constraints nullable="false" />
</column>
<column name="NAME" type="NVARCHAR(255)" />
<column name="NAME" type="VARCHAR(255)" />
<column name="CREATOR_ID" type="BIGINT">
<constraints nullable="false" />
</column>
Expand All @@ -54,42 +56,46 @@
</column>
</createTable>
<modifySql dbms="mysql">
<append value=" ENGINE=INNODB CHARSET=UTF8 COLLATE utf8_general_ci" />
<append value=" ENGINE=INNODB CHARSET=UTF8MB4 COLLATE utf8mb4_0900_ai_ci" />
</modifySql>
</changeSet>

<changeSet author="metadata" id="1.0.0-2">
<validCheckSum>9:a4e65111347150fe7c485c0c8a127b69</validCheckSum>
<validCheckSum>9:e431c1166e876ca7788c2799ffabcb6b</validCheckSum>
<createTable tableName="SOC_METADATA_PROPERTIES">
<column name="METADATA_ID" type="BIGINT">
<constraints foreignKeyName="FK_SOC_METADATA_PROPERTIES_METADATAS" references="SOC_METADATAS(METADATA_ID)" deferrable="false" initiallyDeferred="false" deleteCascade="true" />
</column>
<column name="NAME" type="NVARCHAR(255)">
<column name="NAME" type="VARCHAR(255)">
<constraints nullable="false" />
</column>
<column name="VALUE" type="LONGTEXT">
<constraints nullable="false" />
</column>
</createTable>
<modifySql dbms="mysql">
<append value=" ENGINE=INNODB CHARSET=UTF8 COLLATE utf8_general_ci" />
<append value=" ENGINE=INNODB CHARSET=UTF8MB4 COLLATE utf8mb4_0900_ai_ci" />
</modifySql>
</changeSet>

<changeSet author="metadata" id="1.0.0-3">
<validCheckSum>9:f68fb9277e1de878bd3f38c5a2720f5a</validCheckSum>
<validCheckSum>9:c1c64368bdba035f8fdd67c378bcdf04</validCheckSum>
<createTable tableName="SOC_METADATA_ITEMS">
<column name="METADATA_ITEM_ID" type="BIGINT" autoIncrement="${autoIncrement}" startWith="1">
<constraints nullable="false" primaryKey="true" primaryKeyName="PK_SOC_METADATA_ITEMS" />
</column>
<column name="METADATA_ID" type="BIGINT">
<constraints foreignKeyName="FK_SOC_METADATA_ITEMS_METADATAS" references="SOC_METADATAS(METADATA_ID)" deleteCascade="true" />
</column>
<column name="OBJECT_TYPE" type="NVARCHAR(255)">
<column name="OBJECT_TYPE" type="VARCHAR(255)">
<constraints nullable="false" />
</column>
<column name="OBJECT_ID" type="NVARCHAR(255)">
<column name="OBJECT_ID" type="VARCHAR(255)">
<constraints nullable="false" />
</column>
<column name="PARENT_OBJECT_ID" type="NVARCHAR(255)" />
<column name="PARENT_OBJECT_ID" type="VARCHAR(255)" />
<column name="CREATOR_ID" type="BIGINT">
<constraints nullable="false" />
</column>
Expand All @@ -98,36 +104,38 @@
</column>
</createTable>
<modifySql dbms="mysql">
<append value=" ENGINE=INNODB CHARSET=UTF8 COLLATE utf8_general_ci" />
<append value=" ENGINE=INNODB CHARSET=UTF8MB4 COLLATE utf8mb4_0900_ai_ci" />
</modifySql>
</changeSet>

<changeSet author="metadata" id="1.0.0-4">
<validCheckSum>9:6e43c4b1efd98f990275a9d514cf2a94</validCheckSum>
<validCheckSum>9:a7d5bc26f7b382c58e58f012628dbdc8</validCheckSum>
<createTable tableName="SOC_METADATA_ITEMS_PROPERTIES">
<column name="METADATA_ITEM_ID" type="BIGINT">
<constraints foreignKeyName="FK_SOC_METADATA_ITEM_PROPERTIES_METADATA_ITEMS" references="SOC_METADATA_ITEMS(METADATA_ITEM_ID)" deferrable="false" initiallyDeferred="false" deleteCascade="true" />
</column>
<column name="NAME" type="NVARCHAR(255)">
<column name="NAME" type="VARCHAR(255)">
<constraints nullable="false" />
</column>
<column name="VALUE" type="LONGTEXT">
<constraints nullable="false" />
</column>
</createTable>
<modifySql dbms="mysql">
<append value=" ENGINE=INNODB CHARSET=UTF8 COLLATE utf8_general_ci" />
<append value=" ENGINE=INNODB CHARSET=UTF8MB4 COLLATE utf8mb4_0900_ai_ci" />
</modifySql>
</changeSet>

<changeSet author="metadata" id="1.0.0-5">
<createIndex tableName="SOC_METADATAS" indexName="IDX_SOC_METADATA_01">
<column name="TYPE" type="BIGINT"></column>
<column name="NAME" type="NVARCHAR(255)"></column>
<column name="NAME" type="VARCHAR(255)"></column>
<column name="AUDIENCE_ID" type="BIGINT"></column>
</createIndex>
<createIndex tableName="SOC_METADATA_ITEMS" indexName="IDX_SOC_METADATA_ITEMS_OBJECT_01">
<column name="OBJECT_TYPE" type="NVARCHAR(255)"></column>
<column name="OBJECT_ID" type="NVARCHAR(255)"></column>
<column name="OBJECT_TYPE" type="VARCHAR(255)"></column>
<column name="OBJECT_ID" type="VARCHAR(255)"></column>
</createIndex>
</changeSet>

Expand All @@ -138,8 +146,8 @@
<changeSet author="metadata" id="1.0.0-7">
<createIndex tableName="SOC_METADATA_ITEMS" indexName="IDX_SOC_METADATA_ITEMS_OBJECT_02">
<column name="METADATA_ID" type="BIGINT"></column>
<column name="OBJECT_TYPE" type="NVARCHAR(255)"></column>
<column name="OBJECT_ID" type="NVARCHAR(255)"></column>
<column name="OBJECT_TYPE" type="VARCHAR(255)"></column>
<column name="OBJECT_ID" type="VARCHAR(255)"></column>
</createIndex>
</changeSet>

Expand Down Expand Up @@ -173,5 +181,12 @@
</column>
</addColumn>
</changeSet>

</databaseChangeLog>
<changeSet author="metadata" id="1.0.0-13">
<sql dbms="mysql">
ALTER TABLE SOC_METADATAS CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
ALTER TABLE SOC_METADATA_PROPERTIES CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
ALTER TABLE SOC_METADATA_ITEMS CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
ALTER TABLE SOC_METADATA_ITEMS_PROPERTIES CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
</sql>
</changeSet>
</databaseChangeLog>
Loading

0 comments on commit 92471b0

Please sign in to comment.