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
Rename migrations that didn't make it to v59 (#70673)
Chris Trutere153a3290b3e
diff --git a/resources/migrations/059_update_migrations.yaml b/resources/migrations/059_update_migrations.yamlindex 0ae446f636a..7800ebe8a21 100644--- a/resources/migrations/059_update_migrations.yaml+++ b/resources/migrations/059_update_migrations.yaml@@ -3010,458 +3010,6 @@ databaseChangeLog:constraints:nullable: false- # ---------- Group 15: Normalize workspace_input (BOT-955) ----------- # Drop and recreate workspace_input with new schema (without ref_id / transform_version).- # Create workspace_input_transform join table for the m2m relationship.- # Truncate analysis tables so they repopulate on next workspace load.-- - changeSet:- id: v59.2026-02-09T12:00:00- author: qnkhuat- comment: Drop workspace_input table to recreate with normalized schema- preConditions:- - onFail: MARK_RAN- - tableExists:- tableName: workspace_input- - columnExists:- tableName: workspace_input- columnName: ref_id- changes:- - dropTable:- tableName: workspace_input- rollback:- - createTable:- tableName: workspace_input- remarks: External tables that workspace transforms consume from source databases- columns:- - column:- name: id- type: int- autoIncrement: true- constraints:- primaryKey: true- nullable: false- - column:- name: workspace_id- type: int- constraints:- nullable: false- - column:- name: db_id- type: int- constraints:- nullable: false- - column:- name: schema- type: varchar(254)- constraints:- nullable: true- - column:- name: table- type: varchar(254)- constraints:- nullable: false- - column:- name: table_id- type: int- constraints:- nullable: true- - column:- name: ref_id- type: char(36)- constraints:- nullable: false- - column:- name: access_granted- type: ${boolean.type}- defaultValueBoolean: false- constraints:- nullable: false- - column:- name: transform_version- type: bigint- defaultValueNumeric: 0- constraints:- nullable: false- - column:- name: created_at- type: ${timestamp_type}- constraints:- nullable: false- - column:- name: updated_at- type: ${timestamp_type}- constraints:- nullable: false- # Recreate FKs that Group 7 changesets added, so their auto-rollback- # (dropForeignKeyConstraint) succeeds when rolling back further.- - addForeignKeyConstraint:- baseTableName: workspace_input- baseColumnNames: workspace_id- constraintName: fk_workspace_input_workspace_id- referencedTableName: workspace- referencedColumnNames: id- onDelete: CASCADE- - addForeignKeyConstraint:- baseTableName: workspace_input- baseColumnNames: table_id- constraintName: fk_workspace_input_table_id- referencedTableName: metabase_table- referencedColumnNames: id- onDelete: SET NULL-- - changeSet:- id: v59.2026-02-09T12:00:01- author: qnkhuat- comment: Create workspace_input with normalized schema (no ref_id or transform_version)- preConditions:- - onFail: MARK_RAN- - not:- - tableExists:- tableName: workspace_input- changes:- - createTable:- tableName: workspace_input- remarks: External tables that workspace transforms consume from source databases- columns:- - column:- name: id- type: int- autoIncrement: true- constraints:- primaryKey: true- nullable: false- - column:- name: workspace_id- type: int- remarks: FK to workspace- constraints:- nullable: false- - column:- name: db_id- type: int- remarks: Database containing the source table- constraints:- nullable: false- - column:- name: schema- type: varchar(254)- remarks: Schema of the source table (nullable for DBs without schemas)- constraints:- nullable: true- - column:- name: table- type: varchar(254)- remarks: Name of the source table- constraints:- nullable: false- - column:- name: table_id- type: int- remarks: FK to metabase_table if table exists and is synced- constraints:- nullable: true- - column:- name: access_granted- type: ${boolean.type}- remarks: Whether read access has been granted to the workspace user- defaultValueBoolean: false- constraints:- nullable: false- - column:- name: created_at- type: ${timestamp_type}- remarks: Timestamp when the input was created- constraints:- nullable: false- - column:- name: updated_at- type: ${timestamp_type}- remarks: Timestamp when the input was last updated- constraints:- nullable: false-- - changeSet:- id: v59.2026-02-09T12:00:02- author: qnkhuat- comment: Add index on workspace_input.workspace_id- preConditions:- - onFail: MARK_RAN- - not:- - indexExists:- tableName: workspace_input- indexName: idx_workspace_input_workspace_id- changes:- - createIndex:- tableName: workspace_input- indexName: idx_workspace_input_workspace_id- columns:- - column:- name: workspace_id-- - changeSet:- id: v59.2026-02-09T12:00:03- author: qnkhuat- comment: Add index on workspace_input.table_id- preConditions:- - onFail: MARK_RAN- - not:- - indexExists:- tableName: workspace_input- indexName: idx_workspace_input_table_id- changes:- - createIndex:- tableName: workspace_input- indexName: idx_workspace_input_table_id- columns:- - column:- name: table_id-- - changeSet:- id: v59.2026-02-09T12:00:04- author: qnkhuat- comment: Add FK from workspace_input.workspace_id to workspace with CASCADE- preConditions:- - onFail: MARK_RAN- - not:- - foreignKeyConstraintExists:- foreignKeyName: fk_workspace_input_workspace_id- changes:- - addForeignKeyConstraint:- baseTableName: workspace_input- baseColumnNames: workspace_id- constraintName: fk_workspace_input_workspace_id- referencedTableName: workspace- referencedColumnNames: id- onDelete: CASCADE-- - changeSet:- id: v59.2026-02-09T12:00:05- author: qnkhuat- comment: Add FK from workspace_input.table_id to metabase_table with SET NULL- preConditions:- - onFail: MARK_RAN- - not:- - foreignKeyConstraintExists:- foreignKeyName: fk_workspace_input_table_id- changes:- - addForeignKeyConstraint:- baseTableName: workspace_input- baseColumnNames: table_id- constraintName: fk_workspace_input_table_id- referencedTableName: metabase_table- referencedColumnNames: id- onDelete: SET NULL-- - changeSet:- id: v59.2026-02-09T12:00:06- author: qnkhuat- comment: Add unique constraint on workspace_input (workspace_id, db_id, schema, table)- preConditions:- - onFail: MARK_RAN- - not:- - indexExists:- tableName: workspace_input- indexName: uq_workspace_input_table- changes:- - addUniqueConstraint:- tableName: workspace_input- columnNames: workspace_id, db_id, schema, table- constraintName: uq_workspace_input_table-- - changeSet:- id: v59.2026-02-09T12:00:07- author: qnkhuat- comment: Create workspace_input_transform join table for m2m between workspace_input and workspace_transform- preConditions:- - onFail: MARK_RAN- - not:- - tableExists:- tableName: workspace_input_transform- changes:- - createTable:- tableName: workspace_input_transform- remarks: Join table linking workspace inputs to the transforms that depend on them- columns:- - column:- name: id- type: int- autoIncrement: true- constraints:- primaryKey: true- nullable: false- - column:- name: workspace_input_id- type: int- remarks: FK to workspace_input- constraints:- nullable: false- - column:- name: workspace_id- type: int- remarks: FK to workspace (denormalized for query convenience)- constraints:- nullable: false- - column:- name: ref_id- type: char(36)- remarks: ref_id of the workspace_transform that depends on this input- constraints:- nullable: false- - column:- name: transform_version- type: bigint- remarks: The analysis_version of the transform when this row was created- defaultValueNumeric: 0- constraints:- nullable: false- - column:- name: created_at- type: ${timestamp_type}- remarks: Timestamp when the link was created- defaultValueComputed: current_timestamp- constraints:- nullable: false-- - changeSet:- id: v59.2026-02-09T12:00:08- author: qnkhuat- comment: Add index on workspace_input_transform.workspace_input_id- preConditions:- - onFail: MARK_RAN- - not:- - indexExists:- tableName: workspace_input_transform- indexName: idx_workspace_input_transform_input_id- changes:- - createIndex:- tableName: workspace_input_transform- indexName: idx_workspace_input_transform_input_id- columns:- - column:- name: workspace_input_id-- - changeSet:- id: v59.2026-02-09T12:00:09- author: qnkhuat- comment: Add composite index on workspace_input_transform (workspace_id, ref_id)- preConditions:- - onFail: MARK_RAN- - not:- - indexExists:- tableName: workspace_input_transform- indexName: idx_workspace_input_transform_ws_ref- changes:- - createIndex:- tableName: workspace_input_transform- indexName: idx_workspace_input_transform_ws_ref- columns:- - column:- name: workspace_id- - column:- name: ref_id-- - changeSet:- id: v59.2026-02-09T12:00:10- author: qnkhuat- comment: Add FK from workspace_input_transform.workspace_input_id to workspace_input with CASCADE- preConditions:- - onFail: MARK_RAN- - not:- - foreignKeyConstraintExists:- foreignKeyName: fk_wit_workspace_input_id- changes:- - addForeignKeyConstraint:- baseTableName: workspace_input_transform- baseColumnNames: workspace_input_id- constraintName: fk_wit_workspace_input_id- referencedTableName: workspace_input- referencedColumnNames: id- onDelete: CASCADE-- - changeSet:- id: v59.2026-02-09T12:00:11- author: qnkhuat- comment: Add FK from workspace_input_transform.workspace_id to workspace with CASCADE- preConditions:- - onFail: MARK_RAN- - not:- - foreignKeyConstraintExists:- foreignKeyName: fk_wit_workspace_id- changes:- - addForeignKeyConstraint:- baseTableName: workspace_input_transform- baseColumnNames: workspace_id- constraintName: fk_wit_workspace_id- referencedTableName: workspace- referencedColumnNames: id- onDelete: CASCADE-- - changeSet:- id: v59.2026-02-09T12:00:12- author: qnkhuat- comment: Add unique constraint on workspace_input_transform (workspace_input_id, workspace_id, ref_id, transform_version)- preConditions:- - onFail: MARK_RAN- - not:- - indexExists:- tableName: workspace_input_transform- indexName: uq_workspace_input_transform_versioned- changes:- - addUniqueConstraint:- tableName: workspace_input_transform- columnNames: workspace_input_id, workspace_id, ref_id, transform_version- constraintName: uq_workspace_input_transform_versioned-- - changeSet:- id: v59.2026-02-09T12:00:13- author: qnkhuat- comment: Truncate workspace_graph so analysis will re-run- changes:- - delete:- tableName: workspace_graph- rollback:-- - changeSet:- id: v59.2026-02-09T12:00:14- author: qnkhuat- comment: Truncate workspace_output so analysis will re-run- changes:- - delete:- tableName: workspace_output- rollback:-- - changeSet:- id: v59.2026-02-16T12:00:00- author: bronsa- comment: Usage analytics; Remove logs column from v_tasks view- changes:- - sqlFile:- dbms: postgresql- path: instance_analytics_views/tasks/v5/postgres-tasks.sql- relativeToChangelogFile: true- - sqlFile:- dbms: mysql,mariadb- path: instance_analytics_views/tasks/v5/mysql-tasks.sql- relativeToChangelogFile: true- - sqlFile:- dbms: h2- path: instance_analytics_views/tasks/v5/h2-tasks.sql- relativeToChangelogFile: true- rollback:- - sqlFile:- dbms: postgresql- path: instance_analytics_views/tasks/v4/postgres-tasks.sql- relativeToChangelogFile: true- - sqlFile:- dbms: mysql,mariadb- path: instance_analytics_views/tasks/v4/mysql-tasks.sql- relativeToChangelogFile: true- - sqlFile:- dbms: h2- path: instance_analytics_views/tasks/v4/h2-tasks.sql- relativeToChangelogFile: true-- changeSet:id: v59.2026-02-16T18:00:00author: galdre@@ -3487,96 +3035,6 @@ databaseChangeLog:tableName: metabase_databasecolumnName: write_data_details- - changeSet:- id: v59.2026-02-17T12:00:00- author: bronsa- comment: Add query_execution.transform_id for inspector query attribution- changes:- - addColumn:- tableName: query_execution- columns:- - column:- name: transform_id- type: int- remarks: The ID of the Transform associated with this query execution, if any.-- - changeSet:- id: v59.2026-02-17T12:00:01- author: bronsa- comment: Index query_execution.transform_id- changes:- - createIndex:- tableName: query_execution- indexName: idx_query_execution_transform_id- columns:- - column:- name: transform_id-- - changeSet:- id: v59.2026-02-17T12:01:02- author: bronsa- comment: Add query_execution.lens_id for inspector query attribution- changes:- - addColumn:- tableName: query_execution- columns:- - column:- name: lens_id- type: varchar(254)- remarks: The ID of the inspector lens associated with this query execution, if any.-- - changeSet:- id: v59.2026-02-17T12:01:03- author: bronsa- comment: Add query_execution.lens_params for inspector query attribution- changes:- - addColumn:- tableName: query_execution- columns:- - column:- name: lens_params- type: ${text.type}- remarks: JSON-encoded parameters of the inspector lens associated with this query execution, if any.-- - changeSet:- id: v59.2026-02-17T12:01:04- author: bronsa- comment: Updated view v_query_log v4 - add transform_id, lens_id, lens_params- changes:- - sqlFile:- dbms: postgresql- path: instance_analytics_views/query_log/v4/postgres-query_log.sql- relativeToChangelogFile: true- - sqlFile:- dbms: mysql,mariadb- path: instance_analytics_views/query_log/v4/mysql-query_log.sql- relativeToChangelogFile: true- - sqlFile:- dbms: h2- path: instance_analytics_views/query_log/v4/h2-query_log.sql- relativeToChangelogFile: true- rollback:- - sqlFile:- dbms: postgresql- path: instance_analytics_views/query_log/v2/postgres-query_log.sql- relativeToChangelogFile: true- - sqlFile:- dbms: mysql,mariadb- path: instance_analytics_views/query_log/v3/mysql-query_log.sql- relativeToChangelogFile: true- - sqlFile:- dbms: h2- path: instance_analytics_views/query_log/v2/h2-query_log.sql- relativeToChangelogFile: true-- - changeSet:- id: v59.2026-03-03T12:00:00- author: qnkhuat- comment: Unify source-tables format from map to ordered array- changes:- - customChange:- class: "metabase.app_db.custom_migrations.UnifySourceTablesFormat"-- changeSet:id: v59.2026-03-04T00:00:00author: rileythompson@@ -3585,20 +3043,6 @@ databaseChangeLog:- customChange:class: "metabase.app_db.custom_migrations.FixClickHouseUploadDBSchemaNames"- - changeSet:- id: v59.2026-03-06T00:00:00- author: qnkhuat- comment: Fix computed transform tables incorrectly marked as writable- changes:- - sql:- sql: >- UPDATE metabase_table- SET is_writable = FALSE- WHERE data_authority = 'computed'- AND data_source = 'metabase-transform'- AND is_writable = TRUE;- rollback: # rolling back still leaves the fix in place-# >>>>>>>>>> DO NOT ADD NEW MIGRATIONS BELOW THIS LINE! ADD THEM ABOVE <<<<<<<<<<########################################################################################################################diff --git a/resources/migrations/060/20260209_workspace_input_reshape.yaml b/resources/migrations/060/20260209_workspace_input_reshape.yamlnew file mode 100644index 00000000000..e8e8253b8cc--- /dev/null+++ b/resources/migrations/060/20260209_workspace_input_reshape.yaml@@ -0,0 +1,458 @@+## Reshape workspace_input: drop/recreate without ref_id and transform_version,+## add workspace_input_transform join table, truncate analysis tables.+##+## These changesets were originally v59 but landed after the release branch was cut.+## Moved to v60 so cross-version rollback works.+## Each carries a changeSetExecuted precondition so instances that already ran the+## old v59 ID get MARK_RAN (rollback still executes for MARK_RAN).++databaseChangeLog:+ - logicalFilePath: migrations/060_update_migrations.yaml++ - changeSet:+ id: v60.2026-02-09T12:00:00+ author: qnkhuat+ comment: Drop workspace_input table to recreate with normalized schema+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v59.2026-02-09T12:00:00+ author: qnkhuat+ changeLogFile: migrations/059_update_migrations.yaml+ changes:+ - dropTable:+ tableName: workspace_input+ rollback:+ - createTable:+ tableName: workspace_input+ remarks: External tables that workspace transforms consume from source databases+ columns:+ - column:+ name: id+ type: int+ autoIncrement: true+ constraints:+ primaryKey: true+ nullable: false+ - column:+ name: workspace_id+ type: int+ constraints:+ nullable: false+ - column:+ name: db_id+ type: int+ constraints:+ nullable: false+ - column:+ name: schema+ type: varchar(254)+ constraints:+ nullable: true+ - column:+ name: table+ type: varchar(254)+ constraints:+ nullable: false+ - column:+ name: table_id+ type: int+ constraints:+ nullable: true+ - column:+ name: ref_id+ type: char(36)+ constraints:+ nullable: false+ - column:+ name: access_granted+ type: ${boolean.type}+ defaultValueBoolean: false+ constraints:+ nullable: false+ - column:+ name: transform_version+ type: bigint+ defaultValueNumeric: 0+ constraints:+ nullable: false+ - column:+ name: created_at+ type: ${timestamp_type}+ constraints:+ nullable: false+ - column:+ name: updated_at+ type: ${timestamp_type}+ constraints:+ nullable: false+ # Recreate FKs that Group 7 changesets added, so their auto-rollback+ # (dropForeignKeyConstraint) succeeds when rolling back further.+ - addForeignKeyConstraint:+ baseTableName: workspace_input+ baseColumnNames: workspace_id+ constraintName: fk_workspace_input_workspace_id+ referencedTableName: workspace+ referencedColumnNames: id+ onDelete: CASCADE+ - addForeignKeyConstraint:+ baseTableName: workspace_input+ baseColumnNames: table_id+ constraintName: fk_workspace_input_table_id+ referencedTableName: metabase_table+ referencedColumnNames: id+ onDelete: SET NULL++ - changeSet:+ id: v60.2026-02-09T12:00:01+ author: qnkhuat+ comment: Create workspace_input with normalized schema (no ref_id or transform_version)+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v59.2026-02-09T12:00:01+ author: qnkhuat+ changeLogFile: migrations/059_update_migrations.yaml+ changes:+ - createTable:+ tableName: workspace_input+ remarks: External tables that workspace transforms consume from source databases+ columns:+ - column:+ name: id+ type: int+ autoIncrement: true+ constraints:+ primaryKey: true+ nullable: false+ - column:+ name: workspace_id+ type: int+ remarks: FK to workspace+ constraints:+ nullable: false+ - column:+ name: db_id+ type: int+ remarks: Database containing the source table+ constraints:+ nullable: false+ - column:+ name: schema+ type: varchar(254)+ remarks: Schema of the source table (nullable for DBs without schemas)+ constraints:+ nullable: true+ - column:+ name: table+ type: varchar(254)+ remarks: Name of the source table+ constraints:+ nullable: false+ - column:+ name: table_id+ type: int+ remarks: FK to metabase_table if table exists and is synced+ constraints:+ nullable: true+ - column:+ name: access_granted+ type: ${boolean.type}+ remarks: Whether read access has been granted to the workspace user+ defaultValueBoolean: false+ constraints:+ nullable: false+ - column:+ name: created_at+ type: ${timestamp_type}+ remarks: Timestamp when the input was created+ constraints:+ nullable: false+ - column:+ name: updated_at+ type: ${timestamp_type}+ remarks: Timestamp when the input was last updated+ constraints:+ nullable: false++ - changeSet:+ id: v60.2026-02-09T12:00:02+ author: qnkhuat+ comment: Add index on workspace_input.workspace_id+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v59.2026-02-09T12:00:02+ author: qnkhuat+ changeLogFile: migrations/059_update_migrations.yaml+ changes:+ - createIndex:+ tableName: workspace_input+ indexName: idx_workspace_input_workspace_id+ columns:+ - column:+ name: workspace_id++ - changeSet:+ id: v60.2026-02-09T12:00:03+ author: qnkhuat+ comment: Add index on workspace_input.table_id+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v59.2026-02-09T12:00:03+ author: qnkhuat+ changeLogFile: migrations/059_update_migrations.yaml+ changes:+ - createIndex:+ tableName: workspace_input+ indexName: idx_workspace_input_table_id+ columns:+ - column:+ name: table_id++ - changeSet:+ id: v60.2026-02-09T12:00:04+ author: qnkhuat+ comment: Add FK from workspace_input.workspace_id to workspace with CASCADE+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v59.2026-02-09T12:00:04+ author: qnkhuat+ changeLogFile: migrations/059_update_migrations.yaml+ changes:+ - addForeignKeyConstraint:+ baseTableName: workspace_input+ baseColumnNames: workspace_id+ constraintName: fk_workspace_input_workspace_id+ referencedTableName: workspace+ referencedColumnNames: id+ onDelete: CASCADE++ - changeSet:+ id: v60.2026-02-09T12:00:05+ author: qnkhuat+ comment: Add FK from workspace_input.table_id to metabase_table with SET NULL+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v59.2026-02-09T12:00:05+ author: qnkhuat+ changeLogFile: migrations/059_update_migrations.yaml+ changes:+ - addForeignKeyConstraint:+ baseTableName: workspace_input+ baseColumnNames: table_id+ constraintName: fk_workspace_input_table_id+ referencedTableName: metabase_table+ referencedColumnNames: id+ onDelete: SET NULL++ - changeSet:+ id: v60.2026-02-09T12:00:06+ author: qnkhuat+ comment: Add unique constraint on workspace_input (workspace_id, db_id, schema, table)+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v59.2026-02-09T12:00:06+ author: qnkhuat+ changeLogFile: migrations/059_update_migrations.yaml+ changes:+ - addUniqueConstraint:+ tableName: workspace_input+ columnNames: workspace_id, db_id, schema, table+ constraintName: uq_workspace_input_table++ - changeSet:+ id: v60.2026-02-09T12:00:07+ author: qnkhuat+ comment: Create workspace_input_transform join table for m2m between workspace_input and workspace_transform+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v59.2026-02-09T12:00:07+ author: qnkhuat+ changeLogFile: migrations/059_update_migrations.yaml+ changes:+ - createTable:+ tableName: workspace_input_transform+ remarks: Join table linking workspace inputs to the transforms that depend on them+ columns:+ - column:+ name: id+ type: int+ autoIncrement: true+ constraints:+ primaryKey: true+ nullable: false+ - column:+ name: workspace_input_id+ type: int+ remarks: FK to workspace_input+ constraints:+ nullable: false+ - column:+ name: workspace_id+ type: int+ remarks: FK to workspace (denormalized for query convenience)+ constraints:+ nullable: false+ - column:+ name: ref_id+ type: char(36)+ remarks: ref_id of the workspace_transform that depends on this input+ constraints:+ nullable: false+ - column:+ name: transform_version+ type: bigint+ remarks: The analysis_version of the transform when this row was created+ defaultValueNumeric: 0+ constraints:+ nullable: false+ - column:+ name: created_at+ type: ${timestamp_type}+ remarks: Timestamp when the link was created+ defaultValueComputed: current_timestamp+ constraints:+ nullable: false++ - changeSet:+ id: v60.2026-02-09T12:00:08+ author: qnkhuat+ comment: Add index on workspace_input_transform.workspace_input_id+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v59.2026-02-09T12:00:08+ author: qnkhuat+ changeLogFile: migrations/059_update_migrations.yaml+ changes:+ - createIndex:+ tableName: workspace_input_transform+ indexName: idx_workspace_input_transform_input_id+ columns:+ - column:+ name: workspace_input_id++ - changeSet:+ id: v60.2026-02-09T12:00:09+ author: qnkhuat+ comment: Add composite index on workspace_input_transform (workspace_id, ref_id)+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v59.2026-02-09T12:00:09+ author: qnkhuat+ changeLogFile: migrations/059_update_migrations.yaml+ changes:+ - createIndex:+ tableName: workspace_input_transform+ indexName: idx_workspace_input_transform_ws_ref+ columns:+ - column:+ name: workspace_id+ - column:+ name: ref_id++ - changeSet:+ id: v60.2026-02-09T12:00:10+ author: qnkhuat+ comment: Add FK from workspace_input_transform.workspace_input_id to workspace_input with CASCADE+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v59.2026-02-09T12:00:10+ author: qnkhuat+ changeLogFile: migrations/059_update_migrations.yaml+ changes:+ - addForeignKeyConstraint:+ baseTableName: workspace_input_transform+ baseColumnNames: workspace_input_id+ constraintName: fk_wit_workspace_input_id+ referencedTableName: workspace_input+ referencedColumnNames: id+ onDelete: CASCADE++ - changeSet:+ id: v60.2026-02-09T12:00:11+ author: qnkhuat+ comment: Add FK from workspace_input_transform.workspace_id to workspace with CASCADE+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v59.2026-02-09T12:00:11+ author: qnkhuat+ changeLogFile: migrations/059_update_migrations.yaml+ changes:+ - addForeignKeyConstraint:+ baseTableName: workspace_input_transform+ baseColumnNames: workspace_id+ constraintName: fk_wit_workspace_id+ referencedTableName: workspace+ referencedColumnNames: id+ onDelete: CASCADE++ - changeSet:+ id: v60.2026-02-09T12:00:12+ author: qnkhuat+ comment: Add unique constraint on workspace_input_transform (workspace_input_id, workspace_id, ref_id, transform_version)+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v59.2026-02-09T12:00:12+ author: qnkhuat+ changeLogFile: migrations/059_update_migrations.yaml+ changes:+ - addUniqueConstraint:+ tableName: workspace_input_transform+ columnNames: workspace_input_id, workspace_id, ref_id, transform_version+ constraintName: uq_workspace_input_transform_versioned++ - changeSet:+ id: v60.2026-02-09T12:00:13+ author: qnkhuat+ comment: Truncate workspace_graph so analysis will re-run+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v59.2026-02-09T12:00:13+ author: qnkhuat+ changeLogFile: migrations/059_update_migrations.yaml+ changes:+ - delete:+ tableName: workspace_graph+ rollback:++ - changeSet:+ id: v60.2026-02-09T12:00:14+ author: qnkhuat+ comment: Truncate workspace_output so analysis will re-run+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v59.2026-02-09T12:00:14+ author: qnkhuat+ changeLogFile: migrations/059_update_migrations.yaml+ changes:+ - delete:+ tableName: workspace_output+ rollback:diff --git a/resources/migrations/060/20260216_analytics_views.yaml b/resources/migrations/060/20260216_analytics_views.yamlnew file mode 100644index 00000000000..d904cd24ad2--- /dev/null+++ b/resources/migrations/060/20260216_analytics_views.yaml@@ -0,0 +1,163 @@+## Update analytics views: remove logs from v_tasks, add transform/lens+## attribution columns to query_execution, update v_query_log view.+##+## These changesets were originally v59 but landed after the release branch was cut.+## Moved to v60 so cross-version rollback works.++databaseChangeLog:+ - logicalFilePath: migrations/060_update_migrations.yaml++ - changeSet:+ id: v60.2026-02-16T12:00:00+ author: bronsa+ comment: Usage analytics; Remove logs column from v_tasks view+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v59.2026-02-16T12:00:00+ author: bronsa+ changeLogFile: migrations/059_update_migrations.yaml+ changes:+ - sqlFile:+ dbms: postgresql+ path: ../instance_analytics_views/tasks/v5/postgres-tasks.sql+ relativeToChangelogFile: true+ - sqlFile:+ dbms: mysql,mariadb+ path: ../instance_analytics_views/tasks/v5/mysql-tasks.sql+ relativeToChangelogFile: true+ - sqlFile:+ dbms: h2+ path: ../instance_analytics_views/tasks/v5/h2-tasks.sql+ relativeToChangelogFile: true+ rollback:+ - sqlFile:+ dbms: postgresql+ path: ../instance_analytics_views/tasks/v4/postgres-tasks.sql+ relativeToChangelogFile: true+ - sqlFile:+ dbms: mysql,mariadb+ path: ../instance_analytics_views/tasks/v4/mysql-tasks.sql+ relativeToChangelogFile: true+ - sqlFile:+ dbms: h2+ path: ../instance_analytics_views/tasks/v4/h2-tasks.sql+ relativeToChangelogFile: true++ - changeSet:+ id: v60.2026-02-17T12:00:00+ author: bronsa+ comment: Add query_execution.transform_id for inspector query attribution+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v59.2026-02-17T12:00:00+ author: bronsa+ changeLogFile: migrations/059_update_migrations.yaml+ changes:+ - addColumn:+ tableName: query_execution+ columns:+ - column:+ name: transform_id+ type: int+ remarks: The ID of the Transform associated with this query execution, if any.++ - changeSet:+ id: v60.2026-02-17T12:00:01+ author: bronsa+ comment: Index query_execution.transform_id+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v59.2026-02-17T12:00:01+ author: bronsa+ changeLogFile: migrations/059_update_migrations.yaml+ changes:+ - createIndex:+ tableName: query_execution+ indexName: idx_query_execution_transform_id+ columns:+ - column:+ name: transform_id++ - changeSet:+ id: v60.2026-02-17T12:01:02+ author: bronsa+ comment: Add query_execution.lens_id for inspector query attribution+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v59.2026-02-17T12:01:02+ author: bronsa+ changeLogFile: migrations/059_update_migrations.yaml+ changes:+ - addColumn:+ tableName: query_execution+ columns:+ - column:+ name: lens_id+ type: varchar(254)+ remarks: The ID of the inspector lens associated with this query execution, if any.++ - changeSet:+ id: v60.2026-02-17T12:01:03+ author: bronsa+ comment: Add query_execution.lens_params for inspector query attribution+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v59.2026-02-17T12:01:03+ author: bronsa+ changeLogFile: migrations/059_update_migrations.yaml+ changes:+ - addColumn:+ tableName: query_execution+ columns:+ - column:+ name: lens_params+ type: ${text.type}+ remarks: JSON-encoded parameters of the inspector lens associated with this query execution, if any.++ - changeSet:+ id: v60.2026-02-17T12:01:04+ author: bronsa+ comment: Updated view v_query_log v4 - add transform_id, lens_id, lens_params+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v59.2026-02-17T12:01:04+ author: bronsa+ changeLogFile: migrations/059_update_migrations.yaml+ changes:+ - sqlFile:+ dbms: postgresql+ path: ../instance_analytics_views/query_log/v4/postgres-query_log.sql+ relativeToChangelogFile: true+ - sqlFile:+ dbms: mysql,mariadb+ path: ../instance_analytics_views/query_log/v4/mysql-query_log.sql+ relativeToChangelogFile: true+ - sqlFile:+ dbms: h2+ path: ../instance_analytics_views/query_log/v4/h2-query_log.sql+ relativeToChangelogFile: true+ rollback:+ - sqlFile:+ dbms: postgresql+ path: ../instance_analytics_views/query_log/v2/postgres-query_log.sql+ relativeToChangelogFile: true+ - sqlFile:+ dbms: mysql,mariadb+ path: ../instance_analytics_views/query_log/v3/mysql-query_log.sql+ relativeToChangelogFile: true+ - sqlFile:+ dbms: h2+ path: ../instance_analytics_views/query_log/v2/h2-query_log.sql+ relativeToChangelogFile: truediff --git a/resources/migrations/060/20260303_transform_source_tables.yaml b/resources/migrations/060/20260303_transform_source_tables.yamlnew file mode 100644index 00000000000..8e4ad324072--- /dev/null+++ b/resources/migrations/060/20260303_transform_source_tables.yaml@@ -0,0 +1,44 @@+## Fix transform source-tables: unify format from map to ordered array,+## and correct computed transform tables incorrectly marked as writable.+##+## These changesets were originally v59 but landed after the release branch was cut.+## Moved to v60 so cross-version rollback works.++databaseChangeLog:+ - logicalFilePath: migrations/060_update_migrations.yaml++ - changeSet:+ id: v60.2026-03-03T12:00:00+ author: qnkhuat+ comment: Unify source-tables format from map to ordered array+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v59.2026-03-03T12:00:00+ author: qnkhuat+ changeLogFile: migrations/059_update_migrations.yaml+ changes:+ - customChange:+ class: "metabase.app_db.custom_migrations.UnifySourceTablesFormat"++ - changeSet:+ id: v60.2026-03-06T00:00:00+ author: qnkhuat+ comment: Fix computed transform tables incorrectly marked as writable+ preConditions:+ - onFail: MARK_RAN+ - not:+ changeSetExecuted:+ id: v59.2026-03-06T00:00:00+ author: qnkhuat+ changeLogFile: migrations/059_update_migrations.yaml+ changes:+ - sql:+ sql: >+ UPDATE metabase_table+ SET is_writable = FALSE+ WHERE data_authority = 'computed'+ AND data_source = 'metabase-transform'+ AND is_writable = TRUE;+ rollback: # rolling back still leaves the fix in placediff --git a/test/metabase/app_db/custom_migrations_test.clj b/test/metabase/app_db/custom_migrations_test.cljindex 38bfabdeba6..fe841e17733 100644--- a/test/metabase/app_db/custom_migrations_test.clj+++ b/test/metabase/app_db/custom_migrations_test.clj@@ -2776,9 +2776,81 @@(is (nil? (id->target none-id)))(is (nil? (id->target deleted-id))))))))+(deftest fix-clickhouse-upload-db-schema-names-test+ (testing "FixClickHouseUploadDBSchemaNames, v59.2026-03-04T00:00:00: fix clickhouse upload db schema names"+ (encryption-test/with-secret-key "fake-secret-key"+ ;; Test when the upload db doesn't have an upload_schema_name set (both upload db and upload+ ;; tables are in a bad state) and when it does have an upload_schema_name set (upload db and+ ;; new upload tables are in a good state, but existing upload tables are in a bad state)+ (doseq [uploads-schema-name [nil "db_foo"]]+ (impl/test-migrations+ ["v59.2026-03-04T00:00:00"] [migrate!]+ (let [db-id (t2/insert-returning-pk! :metabase_database+ {:name "clickhouse cloud upload db"+ :engine "clickhouse"+ :created_at :%now+ :updated_at :%now+ :uploads_enabled true+ :uploads_schema_name uploads-schema-name+ :uploads_table_prefix "uploads_"+ :details (mi/encrypted-json-in {:dbname "db_foo"})})+ insert-table! (fn [db-id name schema active is-upload display-name]+ (t2/insert-returning-pk! :metabase_table+ {:db_id db-id+ :name name+ :schema schema+ :active active+ :is_upload is-upload+ :display_name display-name+ :created_at :%now+ :updated_at :%now}))+ ;; An uploads table in a good state, created before uploads_schema_name was set to null+ uploaded-0 (insert-table! db-id "uploads_test_table_0" "db_foo" true true "Test Table 0")+ ;; Two upload tables in a bad state, created after uploads_schema_name was set to null+ uploaded-1 (insert-table! db-id "uploads_test_table_1" nil false true "Test Table 1")+ uploaded-2 (insert-table! db-id "uploads_test_table_2" nil false true "Test Table 2")+ ;; The two non-upload versions of the above tables, created by the sync process+ synced-1 (insert-table! db-id "uploads_test_table_1" "db_foo" true false "Uploads Test Table 1")+ synced-2 (insert-table! db-id "uploads_test_table_2" "db_foo" true false "Uploads Test Table 2")+ ;; An unrelated non-upload table in the same schema that should be left alone+ unrelated (insert-table! db-id "unrelated_table" "db_foo" true false "Unrelated Table")]+ (migrate!)+ ;; The uploads db has the correct uploads_schema_name from the details+ (is (= "db_foo" (:uploads_schema_name (t2/select-one :metabase_database :id db-id))))+ (are [exp table-id] (= exp+ (t2/select-one [:metabase_table :name :schema :active :is_upload] :id table-id))+ ;; The upload table that was already in a good state remains unchanged+ {:name "uploads_test_table_0"+ :schema "db_foo"+ :active true+ :is_upload true} uploaded-0+ ;; The two upload tables in a bad state are updated to be active and have the correct schema+ {:name "uploads_test_table_1"+ :schema "db_foo"+ :active true+ :is_upload true} uploaded-1+ {:name "uploads_test_table_2"+ :schema "db_foo"+ :active true+ :is_upload true} uploaded-2+ ;; The two non-upload tables created by the sync have been renamed and set as inactive+ {:name "uploads_test_table_1_retired_69667"+ :schema "db_foo"+ :active false+ :is_upload false} synced-1+ {:name "uploads_test_table_2_retired_69667"+ :schema "db_foo"+ :active false+ :is_upload false} synced-2+ ;; The unrelated table remains unchanged+ {:name "unrelated_table"+ :schema "db_foo"+ :active true+ :is_upload false} unrelated)))))))+(deftest unify-source-tables-format-test- (testing "v59.2026-03-03T12:00:00: convert source-tables from map to vec format"- (impl/test-migrations ["v59.2026-03-03T12:00:00"] [migrate!]+ (testing "v60.2026-03-03T12:00:00: convert source-tables from map to vec format"+ (impl/test-migrations ["v60.2026-03-03T12:00:00"] [migrate!](let [user-id (:id (new-instance-with-default :core_user))db-id (:id (new-instance-with-default :metabase_database));; source-tables as map with int values (FE format)@@ -2851,79 +2923,8 @@(is (= 2 (count st)))))(testing "Rollback converts vec back to map"- (migrate! :down 58)+ (migrate! :down 59)(let [st (get-source-tables :transform {:id int-id})](is (map? st))(is (= 42 (get st "orders")))(is (= 99 (get st "products")))))))))-(deftest fix-clickhouse-upload-db-schema-names-test- (testing "FixClickHouseUploadDBSchemaNames, v59.2026-03-04T00:00:00: fix clickhouse upload db schema names"- (encryption-test/with-secret-key "fake-secret-key"- ;; Test when the upload db doesn't have an upload_schema_name set (both upload db and upload- ;; tables are in a bad state) and when it does have an upload_schema_name set (upload db and- ;; new upload tables are in a good state, but existing upload tables are in a bad state)- (doseq [uploads-schema-name [nil "db_foo"]]- (impl/test-migrations- ["v59.2026-03-04T00:00:00"] [migrate!]- (let [db-id (t2/insert-returning-pk! :metabase_database- {:name "clickhouse cloud upload db"- :engine "clickhouse"- :created_at :%now- :updated_at :%now- :uploads_enabled true- :uploads_schema_name uploads-schema-name- :uploads_table_prefix "uploads_"- :details (mi/encrypted-json-in {:dbname "db_foo"})})- insert-table! (fn [db-id name schema active is-upload display-name]- (t2/insert-returning-pk! :metabase_table- {:db_id db-id- :name name- :schema schema- :active active- :is_upload is-upload- :display_name display-name- :created_at :%now- :updated_at :%now}))- ;; An uploads table in a good state, created before uploads_schema_name was set to null- uploaded-0 (insert-table! db-id "uploads_test_table_0" "db_foo" true true "Test Table 0")- ;; Two upload tables in a bad state, created after uploads_schema_name was set to null- uploaded-1 (insert-table! db-id "uploads_test_table_1" nil false true "Test Table 1")- uploaded-2 (insert-table! db-id "uploads_test_table_2" nil false true "Test Table 2")- ;; The two non-upload versions of the above tables, created by the sync process- synced-1 (insert-table! db-id "uploads_test_table_1" "db_foo" true false "Uploads Test Table 1")- synced-2 (insert-table! db-id "uploads_test_table_2" "db_foo" true false "Uploads Test Table 2")- ;; An unrelated non-upload table in the same schema that should be left alone- unrelated (insert-table! db-id "unrelated_table" "db_foo" true false "Unrelated Table")]- (migrate!)- ;; The uploads db has the correct uploads_schema_name from the details- (is (= "db_foo" (:uploads_schema_name (t2/select-one :metabase_database :id db-id))))- (are [exp table-id] (= exp- (t2/select-one [:metabase_table :name :schema :active :is_upload] :id table-id))- ;; The upload table that was already in a good state remains unchanged- {:name "uploads_test_table_0"- :schema "db_foo"- :active true- :is_upload true} uploaded-0- ;; The two upload tables in a bad state are updated to be active and have the correct schema- {:name "uploads_test_table_1"- :schema "db_foo"- :active true- :is_upload true} uploaded-1- {:name "uploads_test_table_2"- :schema "db_foo"- :active true- :is_upload true} uploaded-2- ;; The two non-upload tables created by the sync have been renamed and set as inactive- {:name "uploads_test_table_1_retired_69667"- :schema "db_foo"- :active false- :is_upload false} synced-1- {:name "uploads_test_table_2_retired_69667"- :schema "db_foo"- :active false- :is_upload false} synced-2- ;; The unrelated table remains unchanged- {:name "unrelated_table"- :schema "db_foo"- :active true- :is_upload false} unrelated)))))))diff --git a/test/metabase/app_db/schema_migrations_test.clj b/test/metabase/app_db/schema_migrations_test.cljindex 5c557f0493c..07d2e00a4db 100644--- a/test/metabase/app_db/schema_migrations_test.clj+++ b/test/metabase/app_db/schema_migrations_test.clj@@ -2870,9 +2870,9 @@results))))))(deftest workspace-input-normalization-migration-test- (testing "Migrations v59.2026-02-09T12:00:00 through v59.2026-02-09T12:00:14:+ (testing "Migrations v60.2026-02-09T12:00:00 through v60.2026-02-09T12:00:14:Drop/recreate workspace_input with normalized schema and create workspace_input_transform"- (impl/test-migrations ["v59.2026-02-09T12:00:00" "v59.2026-02-09T12:00:14"] [migrate!]+ (impl/test-migrations ["v60.2026-02-09T12:00:00" "v60.2026-02-09T12:00:14"] [migrate!];; Create workspace(let [ws-id (first (t2/insert-returning-pks! :workspace{:name "Test Workspace"