The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Move table_transform_target_fk migrations from v60 to v61 (#71717)
Chris Truterd07b1772b80d
diff --git a/resources/migrations/060/20260310_table_transform_target_fk.yaml b/resources/migrations/061/20260330_table_transform_target_fk.yamlsimilarity index 60%rename from resources/migrations/060/20260310_table_transform_target_fk.yamlrename to resources/migrations/061/20260330_table_transform_target_fk.yamlindex 816bb3620ac..67d8ec86b87 100644--- a/resources/migrations/060/20260310_table_transform_target_fk.yaml+++ b/resources/migrations/061/20260330_table_transform_target_fk.yaml@@ -1,11 +1,18 @@## Add target_table_id FK to transform and table FKs on workspace input/output columnsdatabaseChangeLog:- - logicalFilePath: migrations/060_update_migrations.yaml+- changeSet:- id: v60.2026-03-10T00:00:00+ id: v61.2026-03-10T00:00:00author: christrutercomment: Add target_table_id column to transform table+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v60.2026-03-10T00:00:00+ author: christruter+ changeLogFile: migrations/060_update_migrations.yamlchanges:- addColumn:tableName: transform@@ -22,9 +29,16 @@ databaseChangeLog:columnName: target_table_id- changeSet:- id: v60.2026-03-10T00:00:10+ id: v61.2026-03-10T00:00:10author: christrutercomment: Add index on transform.target_table_id+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v60.2026-03-10T00:00:10+ author: christruter+ changeLogFile: migrations/060_update_migrations.yamlchanges:- createIndex:tableName: transform@@ -34,14 +48,16 @@ databaseChangeLog:name: target_table_id- changeSet:- id: v60.2026-03-10T00:00:20+ id: v61.2026-03-10T00:00:20author: christrutercomment: Add FK from transform.target_table_id to metabase_table with SET NULLpreConditions:- onFail: MARK_RAN- not:- - foreignKeyConstraintExists:- foreignKeyName: fk_transform_target_table_id+ changeSetExecuted:+ id: v60.2026-03-10T00:00:20+ author: christruter+ changeLogFile: migrations/060_update_migrations.yamlchanges:- addForeignKeyConstraint:baseTableName: transform@@ -56,18 +72,32 @@ databaseChangeLog:constraintName: fk_transform_target_table_id- changeSet:- id: v60.2026-03-10T00:00:30+ id: v61.2026-03-10T00:00:30author: christrutercomment: Backfill transform.target_table_id from target JSON column+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v60.2026-03-10T00:00:30+ author: christruter+ changeLogFile: migrations/060_update_migrations.yamlchanges:- customChange:class: metabase.app_db.custom_migrations.BackfillTransformTargetTableIdrollback:- changeSet:- id: v60.2026-03-10T00:00:40+ id: v61.2026-03-10T00:00:40author: christrutercomment: Add index on workspace_output.global_table_id+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v60.2026-03-10T00:00:40+ author: christruter+ changeLogFile: migrations/060_update_migrations.yamlchanges:- createIndex:tableName: workspace_output@@ -77,14 +107,16 @@ databaseChangeLog:name: global_table_id- changeSet:- id: v60.2026-03-10T00:00:50+ id: v61.2026-03-10T00:00:50author: christrutercomment: Add FK from workspace_output.global_table_id to metabase_table with SET NULLpreConditions:- onFail: MARK_RAN- not:- - foreignKeyConstraintExists:- foreignKeyName: fk_workspace_output_global_table_id+ changeSetExecuted:+ id: v60.2026-03-10T00:00:50+ author: christruter+ changeLogFile: migrations/060_update_migrations.yamlchanges:- addForeignKeyConstraint:baseTableName: workspace_output@@ -99,9 +131,16 @@ databaseChangeLog:constraintName: fk_workspace_output_global_table_id- changeSet:- id: v60.2026-03-10T00:01:00+ id: v61.2026-03-10T00:01:00author: christrutercomment: Add index on workspace_output.isolated_table_id+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v60.2026-03-10T00:01:00+ author: christruter+ changeLogFile: migrations/060_update_migrations.yamlchanges:- createIndex:tableName: workspace_output@@ -111,14 +150,16 @@ databaseChangeLog:name: isolated_table_id- changeSet:- id: v60.2026-03-10T00:01:10+ id: v61.2026-03-10T00:01:10author: christrutercomment: Add FK from workspace_output.isolated_table_id to metabase_table with SET NULLpreConditions:- onFail: MARK_RAN- not:- - foreignKeyConstraintExists:- foreignKeyName: fk_workspace_output_isolated_table_id+ changeSetExecuted:+ id: v60.2026-03-10T00:01:10+ author: christruter+ changeLogFile: migrations/060_update_migrations.yamlchanges:- addForeignKeyConstraint:baseTableName: workspace_output@@ -133,9 +174,16 @@ databaseChangeLog:constraintName: fk_workspace_output_isolated_table_id- changeSet:- id: v60.2026-03-10T00:01:20+ id: v61.2026-03-10T00:01:20author: christrutercomment: Add index on workspace_input_external.table_id+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v60.2026-03-10T00:01:20+ author: christruter+ changeLogFile: migrations/060_update_migrations.yamlchanges:- createIndex:tableName: workspace_input_external@@ -145,14 +193,16 @@ databaseChangeLog:name: table_id- changeSet:- id: v60.2026-03-10T00:01:30+ id: v61.2026-03-10T00:01:30author: christrutercomment: Add FK from workspace_input_external.table_id to metabase_table with SET NULLpreConditions:- onFail: MARK_RAN- not:- - foreignKeyConstraintExists:- foreignKeyName: fk_workspace_input_external_table_id+ changeSetExecuted:+ id: v60.2026-03-10T00:01:30+ author: christruter+ changeLogFile: migrations/060_update_migrations.yamlchanges:- addForeignKeyConstraint:baseTableName: workspace_input_external@@ -167,9 +217,16 @@ databaseChangeLog:constraintName: fk_workspace_input_external_table_id- changeSet:- id: v60.2026-03-10T00:01:40+ id: v61.2026-03-10T00:01:40author: christrutercomment: Add index on workspace_output_external.global_table_id+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v60.2026-03-10T00:01:40+ author: christruter+ changeLogFile: migrations/060_update_migrations.yamlchanges:- createIndex:tableName: workspace_output_external@@ -179,14 +236,16 @@ databaseChangeLog:name: global_table_id- changeSet:- id: v60.2026-03-10T00:01:50+ id: v61.2026-03-10T00:01:50author: christrutercomment: Add FK from workspace_output_external.global_table_id to metabase_table with SET NULLpreConditions:- onFail: MARK_RAN- not:- - foreignKeyConstraintExists:- foreignKeyName: fk_workspace_output_external_global_table_id+ changeSetExecuted:+ id: v60.2026-03-10T00:01:50+ author: christruter+ changeLogFile: migrations/060_update_migrations.yamlchanges:- addForeignKeyConstraint:baseTableName: workspace_output_external@@ -201,9 +260,16 @@ databaseChangeLog:constraintName: fk_workspace_output_external_global_table_id- changeSet:- id: v60.2026-03-10T00:02:00+ id: v61.2026-03-10T00:02:00author: christrutercomment: Add index on workspace_output_external.isolated_table_id+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v60.2026-03-10T00:02:00+ author: christruter+ changeLogFile: migrations/060_update_migrations.yamlchanges:- createIndex:tableName: workspace_output_external@@ -213,14 +279,16 @@ databaseChangeLog:name: isolated_table_id- changeSet:- id: v60.2026-03-10T00:02:10+ id: v61.2026-03-10T00:02:10author: christrutercomment: Add FK from workspace_output_external.isolated_table_id to metabase_table with SET NULLpreConditions:- onFail: MARK_RAN- not:- - foreignKeyConstraintExists:- foreignKeyName: fk_workspace_output_external_isolated_table_id+ changeSetExecuted:+ id: v60.2026-03-10T00:02:10+ author: christruter+ changeLogFile: migrations/060_update_migrations.yamlchanges:- addForeignKeyConstraint:baseTableName: workspace_output_external@@ -233,3 +301,31 @@ databaseChangeLog:- dropForeignKeyConstraint:baseTableName: workspace_output_externalconstraintName: fk_workspace_output_external_isolated_table_id++ ## On rollforward, clean up any stale v60 changeset rows left from before the version bump.+ - changeSet:+ id: v61.2026-03-10T00:02:20+ author: christruter+ comment: >-+ Delete old v60 changeset rows for table_transform_target_fk migrations+ so the databasechangelog table only contains the v61 versions.+ changes:+ - sql:+ sql: >-+ DELETE FROM ${databasechangelog.name} WHERE id IN (+ 'v60.2026-03-10T00:00:00',+ 'v60.2026-03-10T00:00:10',+ 'v60.2026-03-10T00:00:20',+ 'v60.2026-03-10T00:00:30',+ 'v60.2026-03-10T00:00:40',+ 'v60.2026-03-10T00:00:50',+ 'v60.2026-03-10T00:01:00',+ 'v60.2026-03-10T00:01:10',+ 'v60.2026-03-10T00:01:20',+ 'v60.2026-03-10T00:01:30',+ 'v60.2026-03-10T00:01:40',+ 'v60.2026-03-10T00:01:50',+ 'v60.2026-03-10T00:02:00',+ 'v60.2026-03-10T00:02:10'+ );+ rollback: # nothing to undo - these rows should not exist in v61