Skip to content
Snippets Groups Projects
Commit 2654e922 authored by Ryan Senior's avatar Ryan Senior
Browse files

Parameterize quoting strategy

Quoting all objects works for MySQL/MariaDB but that same setting
causes H2 and PostgreSQL to fail. H2 appears to be quoting table names
in a create table statement but not quoting that same table name when
referenced via a foreign key which fails.

This commit sets up the quote all objects strategy for MySQL/Maria but
leaves the `LEGACY` quoting strategy for H2/PostgreSQL.
parent 381d3ada
No related branches found
No related tags found
No related merge requests found
databaseChangeLog: databaseChangeLog:
# The quoting strategy decides when things like column names should be quoted.
# This is in place to deal with Liquibase not knowing about all of the new
# reserved words in MySQL 8+. Using a column name that is a reserved word
# causes a failure. Quoting all objects breaks H2 support though as it will
# quote table names but not quote that same table name in a foreign key reference
# which will cause a failure when trying to initially setup the database.
- property:
name: quote_strategy
value: QUOTE_ALL_OBJECTS
dbms: mysql,mariadb
- property:
name: quote_strategy
value: LEGACY
dbms: postgresql,h2
- changeSet: - changeSet:
id: '1' id: '1'
author: agilliland author: agilliland
objectQuotingStrategy: QUOTE_ALL_OBJECTS objectQuotingStrategy: ${quote_strategy}
changes: changes:
- createTable: - createTable:
columns: columns:
...@@ -1703,7 +1717,7 @@ databaseChangeLog: ...@@ -1703,7 +1717,7 @@ databaseChangeLog:
- changeSet: - changeSet:
id: 15 id: 15
author: agilliland author: agilliland
objectQuotingStrategy: QUOTE_ALL_OBJECTS objectQuotingStrategy: ${quote_strategy}
changes: changes:
- addColumn: - addColumn:
tableName: revision tableName: revision
...@@ -2066,7 +2080,7 @@ databaseChangeLog: ...@@ -2066,7 +2080,7 @@ databaseChangeLog:
- changeSet: - changeSet:
id: 23 id: 23
author: agilliland author: agilliland
objectQuotingStrategy: QUOTE_ALL_OBJECTS objectQuotingStrategy: ${quote_strategy}
changes: changes:
- modifyDataType: - modifyDataType:
tableName: metabase_table tableName: metabase_table
...@@ -3193,7 +3207,7 @@ databaseChangeLog: ...@@ -3193,7 +3207,7 @@ databaseChangeLog:
- changeSet: - changeSet:
id: 46 id: 46
author: camsaul author: camsaul
objectQuotingStrategy: QUOTE_ALL_OBJECTS objectQuotingStrategy: ${quote_strategy}
changes: changes:
- addNotNullConstraint: - addNotNullConstraint:
tableName: report_dashboardcard tableName: report_dashboardcard
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment