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
databaseChangeLog:
- objectQuotingStrategy: QUOTE_ALL_OBJECTS
- changeSet:
id: v58.2025-10-30T09:03:00
author: sanex3339
comment: Add embedding_type column to report_dashboard table
changes:
- addColumn:
tableName: report_dashboard
columns:
- column:
name: embedding_type
type: varchar(50)
remarks: The type of embedding for this dashboard
constraints:
nullable: true
rollback:
- dropColumn:
tableName: report_dashboard
columnName: embedding_type
- changeSet:
id: v58.2025-10-30T09:03:01
author: sanex3339
comment: Add embedding_type column to report_card table
changes:
- addColumn:
tableName: report_card
columns:
- column:
name: embedding_type
type: varchar(50)
remarks: The type of embedding for this card
constraints:
nullable: true
rollback:
- dropColumn:
tableName: report_card
columnName: embedding_type
- changeSet:
id: v58.2025-11-04T23:09:49
author: edpaget
comment: Create auth_identity table for multi-authentication support
changes:
- createTable:
tableName: auth_identity
remarks: Stores authentication credentials for users. A user can have multiple auth identities.
columns:
- column:
name: id
type: int
remarks: Integer primary key
autoIncrement: true
constraints:
primaryKey: true
nullable: false
- column:
name: user_id
type: int
remarks: Foreign key to core_user
constraints:
nullable: false
- column:
name: provider
type: varchar(50)
remarks: Authentication provider type (password, google, ldap, saml, jwt, support)
constraints:
nullable: false
- column:
name: credentials
type: ${text.type}
remarks: JSON object containing provider-specific credentials
constraints:
nullable: true
- column:
name: metadata
type: ${text.type}
remarks: JSON object containing provider-specific metadata
constraints:
nullable: true
- column:
name: provider_id
type: varchar(255)
remarks: Provider-specific identifier (email for password/Google, DN for LDAP, subject for SAML/JWT)
constraints:
nullable: true
- column:
name: last_used_at
type: ${timestamp_type}
remarks: Timestamp of last successful authentication
constraints:
nullable: true
- column:
name: expires_at
type: ${timestamp_type}
remarks: Timestamp when this authentication method expires (null = never expires)
constraints:
nullable: true
- column:
name: created_at
type: ${timestamp_type}
remarks: Timestamp when this identity was created
constraints:
nullable: false
- column:
name: updated_at
type: ${timestamp_type}
remarks: Timestamp when this identity was last updated
constraints:
nullable: false
rollback:
- dropTable:
tableName: auth_identity
- changeSet:
id: v58.2025-11-04T23:09:58
author: edpaget
comment: Add user_id index to auth_identity table
changes:
- createIndex:
tableName: auth_identity
indexName: idx_auth_identity_user_id
columns:
- column:
name: user_id
rollback:
- dropIndex:
tableName: auth_identity
indexName: idx_auth_identity_user_id
- changeSet:
id: v58.2025-11-04T23:10:00
author: edpaget
comment: Add provider index to auth_identity table
changes:
- createIndex:
tableName: auth_identity
indexName: idx_auth_identity_provider
columns:
- column:
name: provider
rollback:
- dropIndex:
tableName: auth_identity
indexName: idx_auth_identity_provider
- changeSet:
id: v58.2025-11-04T23:10:01
author: edpaget
comment: Add unique constraint to auth_identity table
changes:
- addUniqueConstraint:
tableName: auth_identity
columnNames: user_id, provider
constraintName: unique_auth_identity_user_provider
rollback:
- dropUniqueConstraint:
tableName: auth_identity
constraintName: unique_auth_identity_user_provider
- changeSet:
id: v58.2025-11-06T15:00:43
author: edpaget
comment: Create support_access_grant_log table for tracking support access grants
changes:
- createTable:
tableName: support_access_grant_log
remarks: Store support access grant requests and their lifecycle for audit purposes
columns:
- column:
name: id
type: int
autoIncrement: true
remarks: Unique identifier for the grant
constraints:
primaryKey: true
nullable: false
- column:
name: user_id
type: int
remarks: ID of the admin user who created this grant
constraints:
nullable: true
- column:
name: ticket_number
type: varchar(100)
remarks: Support ticket number associated with this grant
constraints:
nullable: true
- column:
name: notes
type: varchar(255)
remarks: Additional notes associated with this grant
constraints:
nullable: true
- column:
name: grant_start_timestamp
type: ${timestamp_type}
remarks: When the grant becomes active (UTC)
constraints:
nullable: false
- column:
name: grant_end_timestamp
type: ${timestamp_type}
remarks: When the grant expires (UTC)
constraints:
nullable: false
- column:
name: revoked_at
type: ${timestamp_type}
remarks: When the grant was manually revoked (UTC), null if not revoked
constraints:
nullable: true
- column:
name: revoked_by_user_id
type: int
remarks: ID of the admin user who revoked this grant
constraints:
nullable: true
- column:
name: created_at
type: ${timestamp_type}
defaultValueComputed: current_timestamp
remarks: When this record was created (UTC)
constraints:
nullable: false
- column:
name: updated_at
type: ${timestamp_type}
defaultValueComputed: current_timestamp
remarks: When this record was last updated (UTC)
constraints:
nullable: false
rollback:
- dropTable:
tableName: support_access_grant_log
- changeSet:
id: v58.2025-11-06T15:01:00
author: edpaget
comment: Add index for finding support access grants by user
changes:
- createIndex:
indexName: idx_support_access_grant_log_user_id
tableName: support_access_grant_log
columns:
- column:
name: user_id
- changeSet:
id: v58.2025-11-06T15:01:01
author: edpaget
comment: Add index for finding support access grants by revoked_by_user_id
changes:
- createIndex:
indexName: idx_support_access_grant_log_revoked_by_user_id
tableName: support_access_grant_log
columns:
- column:
name: revoked_by_user_id
- changeSet:
id: v58.2025-11-06T15:01:02
author: edpaget
comment: Add foreign key constraint from support_access_grant_log.user_id to core_user with SET NULL on delete
changes:
- addForeignKeyConstraint:
baseTableName: support_access_grant_log
baseColumnNames: user_id
constraintName: fk_support_access_grant_log_user_id
referencedTableName: core_user
referencedColumnNames: id
onDelete: SET NULL
rollback:
- dropForeignKeyConstraint:
baseTableName: support_access_grant_log
constraintName: fk_support_access_grant_log_user_id
- changeSet:
id: v58.2025-11-06T15:01:03
author: edpaget
comment: Add foreign key constraint from support_access_grant_log.revoked_by_user_id to core_user with SET NULL on delete
changes:
- addForeignKeyConstraint:
baseTableName: support_access_grant_log
baseColumnNames: revoked_by_user_id
constraintName: fk_support_access_grant_log_revoked_by_user_id
referencedTableName: core_user
referencedColumnNames: id
onDelete: SET NULL
rollback:
- dropForeignKeyConstraint:
baseTableName: support_access_grant_log
constraintName: fk_support_access_grant_log_revoked_by_user_id
- changeSet:
id: v58.2025-11-06T15:01:04
author: edpaget
comment: Add index for finding active support access grants
changes:
- createIndex:
indexName: idx_support_access_grant_log_active
tableName: support_access_grant_log
columns:
- column:
name: grant_end_timestamp
- column:
name: revoked_at
where: revoked_at IS NULL
- changeSet:
id: v58.2025-11-10T14:39:00
author: wotbrew
comment: Add published_table_id to report_card
changes:
- addColumn:
tableName: report_card
columns:
- column:
name: published_table_id
type: int
remarks: The table id that is 'published' by this model
constraints:
nullable: true
- changeSet:
id: v58.2025-11-10T14:39:01
author: wotbrew
comment: Add index for report_card.published_table_id
changes:
- createIndex:
tableName: report_card
indexName: idx_report_card_published_table_id
columns:
- column:
name: published_table_id
- changeSet:
id: v58.2025-11-10T14:39:02
author: wotbrew
comment: Add foreign key report_card(published_table_id) to metabase_table(id)
changes:
- addForeignKeyConstraint:
baseTableName: report_card
baseColumnNames: published_table_id
referencedTableName: metabase_table
referencedColumnNames: id
constraintName: fk_report_card_published_table
onDelete: SET NULL
- changeSet:
id: v58.2025-11-12T00:00:00
author: edpaget
comment: Add index on provider_id for efficient lookups
changes:
- createIndex:
tableName: auth_identity
indexName: idx_auth_identity_provider_id
columns:
- column:
name: provider_id
rollback:
- dropIndex:
tableName: auth_identity
indexName: idx_auth_identity_provider_id
- changeSet:
id: v58.2025-11-12T00:00:01
author: edpaget
comment: Add composite index on (provider, provider_id) for efficient lookups
changes:
- createIndex:
tableName: auth_identity
indexName: idx_auth_identity_provider_provider_id
columns:
- column:
name: provider
- column:
name: provider_id
rollback:
- dropIndex:
tableName: auth_identity
indexName: idx_auth_identity_provider_provider_id
- changeSet:
id: v58.2025-11-12T00:00:02
author: edpaget
comment: Add foreign key constraint from auth_identity to core_user
changes:
- addForeignKeyConstraint:
baseTableName: auth_identity
baseColumnNames: user_id
constraintName: fk_auth_identity_core_user_id
referencedTableName: core_user
referencedColumnNames: id
onDelete: CASCADE
rollback:
- dropForeignKeyConstraint:
baseTableName: auth_identity
constraintName: fk_auth_identity_core_user_id
- changeSet:
id: v58.2025-11-12T00:00:07
author: edpaget
comment: Add auth_identity_id columns to core_session table
changes:
- addColumn:
tableName: core_session
columns:
- column:
name: auth_identity_id
type: int
remarks: Foreign key to auth_identity - tracks which auth method was used for login
constraints:
nullable: true
rollback:
- dropColumn:
tableName: core_session
columnName: auth_identity_id
- changeSet:
id: v58.2025-11-12T00:00:08
author: edpaget
comment: Add expires_at columns to core_session table
changes:
- addColumn:
tableName: core_session
columns:
- column:
name: expires_at
type: ${timestamp_type}
remarks: Timestamp when this session expires (from auth_identity or calculated)
constraints:
nullable: true
rollback:
- dropColumn:
tableName: core_session
columnName: expires_at
- changeSet:
id: v58.2025-11-12T00:00:09
author: edpaget
comment: Add index on core_session.auth_identity_id
changes:
- createIndex:
tableName: core_session
indexName: idx_core_session_auth_identity_id
columns:
- column:
name: auth_identity_id
rollback:
- dropIndex:
tableName: core_session
indexName: idx_core_session_auth_identity_id
- changeSet:
id: v58.2025-11-12T00:00:10
author: edpaget
comment: Add foreign key constraint from core_session to auth_identity
changes:
- addForeignKeyConstraint:
baseTableName: core_session
baseColumnNames: auth_identity_id
constraintName: fk_session_auth_identity
referencedTableName: auth_identity
referencedColumnNames: id
onDelete: CASCADE
rollback:
- dropForeignKeyConstraint:
baseTableName: core_session
constraintName: fk_session_auth_identity
- changeSet:
id: v58.2025-11-12T00:00:11
author: edpaget
comment: Migrate password authentication to auth_identity table
changes:
- sql:
dbms: postgresql
sql: >-
INSERT INTO auth_identity (user_id, provider, provider_id, credentials, metadata, created_at, updated_at)
SELECT
id,
'password',
LEFT(email, 255),
json_build_object('password_hash', password, 'password_salt', password_salt)::text,
NULL,
COALESCE(date_joined, now()),
now()
FROM core_user
WHERE password IS NOT NULL
ON CONFLICT (user_id, provider) DO NOTHING;
- sql:
dbms: mysql,mariadb
sql: >-
INSERT IGNORE INTO auth_identity (user_id, provider, provider_id, credentials, metadata, created_at, updated_at)
SELECT
id,
'password',
LEFT(email, 255),
json_object('password_hash', password, 'password_salt', password_salt),
NULL,
COALESCE(date_joined, now()),
now()
FROM core_user
WHERE password IS NOT NULL;
- sql:
dbms: h2
sql: >-
INSERT INTO auth_identity (user_id, provider, provider_id, credentials, metadata, created_at, updated_at)
SELECT
id,
'password',
LEFT(email, 255),
CONCAT('{"password_hash":"', password, '","password_salt":"', password_salt, '"}'),
NULL,
COALESCE(date_joined, now()),
now()
FROM core_user
WHERE password IS NOT NULL
AND NOT EXISTS (
SELECT 1 FROM auth_identity ai
WHERE ai.user_id = core_user.id AND ai.provider = 'password'
);
rollback:
- sql: DELETE FROM auth_identity WHERE provider = 'password';
- changeSet:
id: v58.2025-11-12T00:00:12
author: edpaget
comment: Migrate LDAP authentication to auth_identity table
changes:
- sql:
dbms: postgresql
sql: >-
INSERT INTO auth_identity (user_id, provider, provider_id, credentials, metadata, created_at, updated_at)
SELECT
id,
'ldap',
LEFT(email, 255),
NULL,
json_build_object('login_attributes', login_attributes)::text,
COALESCE(date_joined, now()),
now()
FROM core_user
WHERE sso_source = 'ldap'
ON CONFLICT (user_id, provider) DO NOTHING;
- sql:
dbms: mysql,mariadb
sql: >-
INSERT IGNORE INTO auth_identity (user_id, provider, provider_id, credentials, metadata, created_at, updated_at)
SELECT
id,
'ldap',
LEFT(email, 255),
NULL,
json_object('login_attributes', login_attributes),
COALESCE(date_joined, now()),
now()
FROM core_user
WHERE sso_source = 'ldap';
- sql:
dbms: h2
sql: >-
INSERT INTO auth_identity (user_id, provider, provider_id, credentials, metadata, created_at, updated_at)
SELECT
id,
'ldap',
LEFT(email, 255),
NULL,
CONCAT('{"login_attributes":', COALESCE(login_attributes, 'null'), '}'),
COALESCE(date_joined, now()),
now()
FROM core_user
WHERE sso_source = 'ldap'
AND NOT EXISTS (
SELECT 1 FROM auth_identity ai
WHERE ai.user_id = core_user.id AND ai.provider = 'ldap'
);
rollback:
- sql: DELETE FROM auth_identity WHERE provider = 'ldap';
- changeSet:
id: v58.2025-11-12T00:00:13
author: edpaget
comment: Migrate Google SSO authentication to auth_identity table
changes:
- sql:
dbms: postgresql
sql: >-
INSERT INTO auth_identity (user_id, provider, provider_id, credentials, metadata, created_at, updated_at)
SELECT
id,
'google',
LEFT(email, 255),
NULL,
json_build_object('sso_source', 'google', 'login_attributes', login_attributes)::text,
COALESCE(date_joined, now()),
now()
FROM core_user
WHERE sso_source = 'google'
ON CONFLICT (user_id, provider) DO NOTHING;
- sql:
dbms: mysql,mariadb
sql: >-
INSERT IGNORE INTO auth_identity (user_id, provider, provider_id, credentials, metadata, created_at, updated_at)
SELECT
id,
'google',
LEFT(email, 255),
NULL,
json_object('sso_source', 'google', 'login_attributes', login_attributes),
COALESCE(date_joined, now()),
now()
FROM core_user
WHERE sso_source = 'google';
- sql:
dbms: h2
sql: >-
INSERT INTO auth_identity (user_id, provider, provider_id, credentials, metadata, created_at, updated_at)
SELECT
id,
'google',
LEFT(email, 255),
NULL,
CONCAT('{"sso_source":"google","login_attributes":', COALESCE(login_attributes, 'null'), '}'),
COALESCE(date_joined, now()),
now()
FROM core_user
WHERE sso_source = 'google'
AND NOT EXISTS (
SELECT 1 FROM auth_identity ai
WHERE ai.user_id = core_user.id AND ai.provider = 'google'
);
rollback:
- sql: DELETE FROM auth_identity WHERE provider = 'google';
- changeSet:
id: v58.2025-11-12T00:00:14
author: edpaget
comment: Migrate SAML and JWT authentication to auth_identity table
changes:
- sql:
dbms: postgresql
sql: >-
INSERT INTO auth_identity (user_id, provider, provider_id, credentials, metadata, created_at, updated_at)
SELECT
id,
sso_source,
LEFT(email, 255),
NULL,
json_build_object('sso_source', sso_source, 'login_attributes', login_attributes, 'jwt_attributes', jwt_attributes)::text,
COALESCE(date_joined, now()),
now()
FROM core_user
WHERE sso_source IN ('saml', 'jwt')
ON CONFLICT (user_id, provider) DO NOTHING;
- sql:
dbms: mysql,mariadb
sql: >-
INSERT IGNORE INTO auth_identity (user_id, provider, provider_id, credentials, metadata, created_at, updated_at)
SELECT
id,
sso_source,
LEFT(email, 255),
NULL,
json_object('sso_source', sso_source, 'login_attributes', login_attributes, 'jwt_attributes', jwt_attributes),
COALESCE(date_joined, now()),
now()
FROM core_user
WHERE sso_source IN ('saml', 'jwt');
- sql:
dbms: h2
sql: >-
INSERT INTO auth_identity (user_id, provider, provider_id, credentials, metadata, created_at, updated_at)
SELECT
id,
sso_source,
LEFT(email, 255),
NULL,
CONCAT('{"sso_source":"', sso_source, '","login_attributes":', COALESCE(login_attributes, 'null'), ',"jwt_attributes":', COALESCE(jwt_attributes, 'null'), '}'),
COALESCE(date_joined, now()),
now()
FROM core_user
WHERE sso_source IN ('saml', 'jwt')
AND NOT EXISTS (
SELECT 1 FROM auth_identity ai
WHERE ai.user_id = core_user.id AND ai.provider = core_user.sso_source
);
rollback:
- sql: DELETE FROM auth_identity WHERE provider IN ('saml', 'jwt');
- changeSet:
id: v58.2025-11-12T11:57:00
author: wotbrew
comment: Add data_source column to metabase_table
changes:
- addColumn:
tableName: metabase_table
columns:
- column:
name: data_source
type: varchar(254)
remarks: The origin type of the data (e.g. metabase-transform)
constraints:
nullable: true
- changeSet:
id: v58.2025-11-12T11:57:02
author: wotbrew
comment: Add data_layer column to metabase_table
changes:
- addColumn:
tableName: metabase_table
columns:
- column:
name: data_layer
type: varchar(254)
remarks: The (new) enum for visibility class
constraints:
nullable: true
- changeSet:
id: v58.2025-11-12T11:57:03
author: wotbrew
comment: Add owner_email column to metabase_table
changes:
- addColumn:
tableName: metabase_table
columns:
- column:
name: owner_email
type: ${text.type}
remarks: An optional email address of the 'owner' of this table, exclusive with owner_user_id.
constraints:
nullable: true
- changeSet:
id: v58.2025-11-12T11:57:04
author: wotbrew
comment: Add owner_user_id column to metabase_table
changes:
- addColumn:
tableName: metabase_table
columns:
- column:
name: owner_user_id
type: int
remarks: An (metabase) user id of the 'owner' of this table, exclusive with owner_email.
constraints:
nullable: true
- changeSet:
id: v58.2025-11-13T10:00:00
author: qnkhuat
comment: Backfill data_layer from visibility_type
changes:
- sql: >-
UPDATE metabase_table
SET data_layer = CASE
WHEN visibility_type IN ('hidden', 'retired', 'sensitive', 'technical', 'cruft') THEN 'copper'
ELSE 'bronze'
END
rollback:
- sql: >-
UPDATE metabase_table
SET visibility_type = CASE
WHEN data_layer = 'copper' THEN 'hidden'
ELSE NULL
END
- sql: >-
UPDATE metabase_table
SET data_layer = NULL
- changeSet:
id: v58.2025-11-18T12:31:27
author: johnswanson
comment: Create `tenant` table
preConditions: # not needed
changes:
- createTable:
tableName: tenant
remarks: |
Tenants (collections of external users). A user can be in exactly zero or one tenants.
columns:
- column:
name: id
type: int
autoIncrement: true
remarks: the ID of the tenant
constraints:
primaryKey: true
nullable: false
- column:
name: "name"
type: varchar(254)
remarks: the unique name of the tenant
constraints:
nullable: false
unique: true
- column:
name: "slug"
type: varchar(254)
remarks: "the slugified version of this tenant's name"
constraints:
nullable: false
unique: true
- column:
name: "is_active"
type: ${boolean.type}
remarks: Whether the tenant is active or not
defaultValueBoolean: true
constraints:
nullable: false
- column:
name: updated_at
type: ${timestamp_type}
remarks: The timestamp of when the tenant was updated
constraints:
nullable: false
- column:
name: created_at
type: ${timestamp_type}
remarks: The timestamp of when the tenant was created
constraints:
nullable: false
- changeSet:
id: v58.2025-11-18T12:31:44
author: johnswanson
comment: add an index for `core_user.tenant_id`
changes:
- createIndex:
tableName: core_user
indexName: idx_core_user_tenant_id
columns:
- column:
name: tenant_id
- changeSet:
id: v58.2025-11-18T12:31:47
author: johnswanson
comment: Add foreign key for `core_user.tenant_id`
preConditions: # not needed
changes:
- addForeignKeyConstraint:
baseTableName: core_user
baseColumnNames: tenant_id
referencedTableName: tenant
referencedColumnNames: id
constraintName: fk_core_user_tenant_id
onDelete: RESTRICT
- changeSet:
id: v58.2025-11-18T12:31:49
author: johnswanson
comment: Rename any existing `@.+` user attributes to add a preceding underscore
changes:
- customChange:
class: "metabase.app_db.custom_migrations.MoveExistingAtSymbolUserAttributes"
- changeSet:
id: v58.2025-11-18T12:31:51
author: johnswanson
comment: Mark users with `deactivated_with_tenant`
changes:
- addColumn:
tableName: core_user
columns:
- column:
name: deactivated_with_tenant
remarks: |
if this user and its tenant are both deactivated, represents whether the user was deactivated
*with* the tenant (in which case it should be reactivated when the tenant is reactivated)
or was deactivated independently.
type: ${boolean.type}
constraints:
nullable: true
- changeSet:
id: v58.2025-11-18T12:31:53
author: edpaget
comment: add column for tenant attributes
preConditions: # not needed
changes:
- addColumn:
tableName: tenant
columns:
- column:
name: attributes
type: ${text.type}
remarks: JSON object containing custom tenant attributes
constraints:
nullable: true
- changeSet:
id: v58.2025-11-18T12:31:54
author: johnswanson
comment: External Users groups
rollback:
- sql:
sql: >-
DELETE FROM permissions_group WHERE magic_group_type IN ('all-external-users', 'read-external-users', 'write-external-users');
changes:
- sql:
sql: >-
INSERT INTO permissions_group (name, magic_group_type, is_tenant_group)
VALUES
('All tenant users', 'all-external-users', true);
- changeSet:
id: v58.2025-11-19T00:00:00
author: edpaget
comment: Add is_remote_synced boolean column to collection table
changes:
- addColumn:
tableName: collection
columns:
- column:
name: is_remote_synced
type: ${boolean.type}
remarks: Indicates if this collection is synced from a remote source
defaultValueBoolean: false
constraints:
nullable: true
rollback:
- dropColumn:
tableName: collection
columnName: is_remote_synced
- changeSet:
id: v58.2025-11-19T00:00:01
author: edpaget
comment: Migrate existing remote-synced collections to use is_remote_synced column
changes:
- sql:
sql: UPDATE collection SET is_remote_synced = true WHERE type = 'remote-synced'
rollback:
- sql:
sql: UPDATE collection SET is_remote_synced = false WHERE type = 'remote-synced'
- changeSet:
id: v58.2025-11-19T00:00:02
author: edpaget
comment: Clear remote-synced type value (replaced by is_remote_synced column)
changes:
- sql:
sql: UPDATE collection SET type = NULL WHERE type = 'remote-synced'
rollback:
- sql:
sql: UPDATE collection SET type = 'remote-synced' WHERE is_remote_synced = true
- changeSet:
id: v58.2025-11-25T00:00:00
author: edpaget
comment: Add default read permissions for All Users group on shared-tenant-collection root
changes:
- sql:
sql: >-
INSERT INTO permissions (group_id, object)
SELECT pg.id, '/collection/namespace/shared-tenant-collection/root/read/'
FROM permissions_group pg
WHERE pg.magic_group_type = 'all-internal-users'
AND NOT EXISTS (
SELECT 1 FROM permissions p
WHERE p.group_id = pg.id
AND p.object = '/collection/namespace/shared-tenant-collection/root/read/'
);
rollback:
- sql:
sql: >-
DELETE FROM permissions
WHERE object = '/collection/namespace/shared-tenant-collection/root/read/'
AND group_id IN (SELECT id FROM permissions_group WHERE magic_group_type = 'all-internal-users');
- changeSet:
id: v58.2025-11-25T00:00:01
author: edpaget
comment: Add default read permissions for All External Users group on shared-tenant-collection root
changes:
- sql:
sql: >-
INSERT INTO permissions (group_id, object)
SELECT pg.id, '/collection/namespace/shared-tenant-collection/root/read/'
FROM permissions_group pg
WHERE pg.magic_group_type = 'all-external-users'
AND NOT EXISTS (
SELECT 1 FROM permissions p
WHERE p.group_id = pg.id
AND p.object = '/collection/namespace/shared-tenant-collection/root/read/'
);
rollback:
- sql:
sql: >-
DELETE FROM permissions
WHERE object = '/collection/namespace/shared-tenant-collection/root/read/'
AND group_id IN (SELECT id FROM permissions_group WHERE magic_group_type = 'all-external-users');
- changeSet:
id: v58.2025-11-25T17:04:00
author: dependencies
comment: Add dependency_analysis_version to segment table for tracking dependency changes
preConditions:
- onFail: MARK_RAN
- not:
changeSetExecuted:
id: v57.2025-11-25T17:04:00
author: dependencies
changeLogFile: migrations/057_update_migrations.yaml
changes:
- addColumn:
tableName: segment
columns:
- column:
name: dependency_analysis_version
type: integer
defaultValueNumeric: 0
remarks: Version number for dependency analysis to track when dependencies need recalculation
constraints:
nullable: false
rollback:
- dropColumn:
tableName: segment
columnName: dependency_analysis_version
- changeSet:
id: v58.2025-11-25T17:41:50
author: metamben
comment: Add collection_id column to metabase_table for publishing tables to collections
changes:
- addColumn:
tableName: metabase_table
columns:
- column:
name: collection_id
type: int
remarks: The collection this table is published to (null if not published or published to root)
constraints:
nullable: true
- changeSet:
id: v58.2025-11-25T17:41:51
author: metamben
comment: Add index on metabase_table.collection_id
changes:
- createIndex:
tableName: metabase_table
indexName: idx_metabase_table_collection_id
columns:
- column:
name: collection_id
- changeSet:
id: v58.2025-11-25T17:41:52
author: metamben
comment: Add foreign key constraint from metabase_table.collection_id to collection.id
changes:
- addForeignKeyConstraint:
baseTableName: metabase_table
baseColumnNames: collection_id
constraintName: fk_metabase_table_collection_id
referencedTableName: collection
referencedColumnNames: id
- changeSet:
id: v58.2025-11-25T17:41:53
author: metamben
comment: Add is_published column to metabase_table
changes:
- addColumn:
tableName: metabase_table
columns:
- column:
name: is_published
type: ${boolean.type}
remarks: Whether this table is published
defaultValueBoolean: false
constraints:
nullable: false
- changeSet:
id: v58.2025-12-01T05:21:37
author: johnswanson
comment: Add a tenant_collection_id to tenants
changes:
- addColumn:
tableName: tenant
columns:
- column:
name: tenant_collection_id
type: int
remarks: The ID of the collection
constraints:
nullable: false
- changeSet:
id: v58.2025-12-05T17:41:51
author: ranquild
comment: Drop fk_report_card_published_table
changes:
- dropForeignKeyConstraint:
baseTableName: report_card
constraintName: fk_report_card_published_table
rollback:
- addForeignKeyConstraint:
baseTableName: report_card
baseColumnNames: published_table_id
referencedTableName: metabase_table
referencedColumnNames: id
constraintName: fk_report_card_published_table
onDelete: SET NULL
- changeSet:
id: v58.2025-12-05T17:41:52
author: ranquild
comment: Drop idx_report_card_published_table_id
changes:
- dropIndex:
tableName: report_card
indexName: idx_report_card_published_table_id
rollback:
- createIndex:
tableName: report_card
indexName: idx_report_card_published_table_id
columns:
- column:
name: published_table_id
- changeSet:
id: v58.2025-12-05T17:41:53
author: ranquild
comment: Drop report_card.published_table_id
changes:
- dropColumn:
tableName: report_card
columnName: published_table_id
rollback:
- addColumn:
tableName: report_card
columns:
- column:
name: published_table_id
type: int
remarks: The table id that is 'published' by this model
constraints:
nullable: true
- changeSet:
id: v58.2025-12-05T17:41:54
author: ranquild
comment: Rename collection.type 'library-models' to 'library-data'
changes:
- update:
tableName: collection
columns:
- column:
name: type
value: 'library-data'
where: type = 'library-models'
rollback:
- update:
tableName: collection
columns:
- column:
name: type
value: 'library-models'
where: type = 'library-data'
- changeSet:
id: v58.2025-12-09T00:00:00
author: nmezzopera
comment: Usage analytics; Add entity_type, visibility_type, estimated_row_count, view_count, owner_email, owner_user_id to tables
changes:
- sqlFile:
dbms: postgresql
path: instance_analytics_views/tables/v3/postgres-tables.sql
relativeToChangelogFile: true
- sqlFile:
dbms: mysql,mariadb
path: instance_analytics_views/tables/v3/mysql-tables.sql
relativeToChangelogFile: true
- sqlFile:
dbms: h2
path: instance_analytics_views/tables/v3/h2-tables.sql
relativeToChangelogFile: true
rollback:
- sqlFile:
dbms: postgresql
path: instance_analytics_views/tables/v1/postgres-tables.sql
relativeToChangelogFile: true
- sqlFile:
dbms: mysql,mariadb
path: instance_analytics_views/tables/v2/mysql-tables.sql
relativeToChangelogFile: true
- sqlFile:
dbms: h2
path: instance_analytics_views/tables/v1/h2-tables.sql
relativeToChangelogFile: true
- changeSet:
id: v58.2025-12-18T16:14:03
author: winlost
comment: Add disable_links column to pulse table
changes:
- addColumn:
tableName: pulse
columns:
- column:
name: disable_links
type: ${boolean.type}
remarks: "Whether to disable email subscription links"
defaultValueBoolean: false
constraints:
nullable: true
rollback:
- dropColumn:
tableName: pulse
columnName: disable_links
- changeSet:
id: v58.2026-04-01T10:00:00
author: epaget
comment: Add last_active_at to core_session for server-side session timeout enforcement
changes:
- addColumn:
tableName: core_session
columns:
- column:
name: last_active_at
type: ${timestamp_type}
remarks: Tracks when the session was last used, for inactivity timeout enforcement
constraints:
nullable: true
# data_permissions had no unique constraint on (group_id, perm_type, db_id, table_id), so nothing
# prevented duplicate rows for the same scope. Duplicate DB-level rows caused a sandbox data leak:
# the going-granular path for newly-synced tables deleted only one of them, and the survivor
# out-voted the new table's :blocked row at enforcement time (most-permissive coalesce). The three
# changesets below delete existing duplicates (keeping the most restrictive value, lowest id as
# tie-break), then make the duplicate state unrepresentable with a unique constraint. Because
# table_id is nullable and all three app DBs treat NULLs as distinct in unique indexes (and H2 has
# no partial indexes, MariaDB no functional indexes), the constraint goes through a generated
# column that coalesces NULL table_id to -1 — same approach as metabase_table's
# unique_table_helper (v55.2025-05-19). Unlike that precedent our base column (table_id) carries an
# ON DELETE CASCADE foreign key, and MySQL rejects STORED generated columns on such base columns
# (errno 1215), so MySQL/MariaDB use a VIRTUAL generated column instead — unique indexes on virtual
# columns are supported by both, and the cascade still fires (verified on MySQL 8.0 and
# MariaDB 10.6). Postgres has no virtual generated columns and no such FK restriction, so it keeps
# STORED.
- changeSet:
id: v58.2026-07-31T00:00:00
author: johnswanson
comment: Delete duplicate data_permissions rows, keeping the most restrictive value per scope
changes:
- sql:
# The CASE ranks perm_value from most to least restrictive; rows within a partition always
# share a perm_type, so only the ordering within each perm_type's value set matters.
# Unknown values sort last and lose to any known value.
sql: >-
DELETE FROM data_permissions WHERE id IN (
SELECT id FROM (
SELECT id,
ROW_NUMBER() OVER (
PARTITION BY group_id, perm_type, db_id, COALESCE(table_id, -1)
ORDER BY
CASE perm_value
WHEN 'blocked' THEN 0
WHEN 'no' THEN 0
WHEN 'legacy-no-self-service' THEN 1
WHEN 'query-builder' THEN 1
WHEN 'ten-thousand-rows' THEN 1
ELSE 2
END,
id
) AS row_num
FROM data_permissions
) x
WHERE x.row_num > 1
);
rollback: # nothing to restore; deleting duplicate rows is intentionally irreversible
- changeSet:
id: v58.2026-07-31T00:00:01
author: johnswanson
comment: Add data_permissions.unique_perms_helper for a NULL-safe unique constraint on table_id
changes:
- sql:
dbms: postgresql
sql: >-
ALTER TABLE data_permissions ADD COLUMN unique_perms_helper INTEGER GENERATED ALWAYS AS (
COALESCE(table_id, -1)
) STORED;
- sql:
dbms: mysql,mariadb
sql: >-
ALTER TABLE data_permissions ADD COLUMN unique_perms_helper INTEGER GENERATED ALWAYS AS (
COALESCE(table_id, -1)
) VIRTUAL;
- sql:
dbms: h2
sql: >-
ALTER TABLE data_permissions ADD COLUMN unique_perms_helper INTEGER GENERATED ALWAYS AS (
COALESCE(table_id, -1)
);
rollback:
- sql:
sql: ALTER TABLE data_permissions DROP COLUMN unique_perms_helper;
- changeSet:
id: v58.2026-07-31T00:00:02
author: johnswanson
comment: Add unique constraint on data_permissions(group_id, perm_type, db_id, unique_perms_helper)
changes:
- addUniqueConstraint:
tableName: data_permissions
constraintName: idx_unique_data_permissions
columnNames: group_id, perm_type, db_id, unique_perms_helper
rollback:
- dropUniqueConstraint:
tableName: data_permissions
constraintName: idx_unique_data_permissions
- changeSet:
id: v58.2026-08-25T00:00:02
author: ranquild
comment: Widen report_card.public_uuid so it can hold the encrypted value written by EncryptPublicUuids.
changes:
- modifyDataType:
tableName: report_card
columnName: public_uuid
newDataType: varchar(254)
rollback:
- modifyDataType:
tableName: report_card
columnName: public_uuid
newDataType: char(36)
- changeSet:
id: v58.2026-08-25T00:00:03
author: ranquild
comment: Widen report_dashboard.public_uuid so it can hold the encrypted value written by EncryptPublicUuids.
changes:
- modifyDataType:
tableName: report_dashboard
columnName: public_uuid
newDataType: varchar(254)
rollback:
- modifyDataType:
tableName: report_dashboard
columnName: public_uuid
newDataType: char(36)
- changeSet:
id: v58.2026-08-25T00:00:04
author: ranquild
comment: Widen action.public_uuid so it can hold the encrypted value written by EncryptPublicUuids.
changes:
- modifyDataType:
tableName: action
columnName: public_uuid
newDataType: varchar(254)
rollback:
- modifyDataType:
tableName: action
columnName: public_uuid
newDataType: char(36)
- changeSet:
id: v58.2026-08-25T00:00:05
author: ranquild
comment: Widen document.public_uuid so it can hold the encrypted value written by EncryptPublicUuids.
changes:
- modifyDataType:
tableName: document
columnName: public_uuid
newDataType: varchar(254)
rollback:
- modifyDataType:
tableName: document
columnName: public_uuid
newDataType: char(36)
- changeSet:
id: v58.2026-08-25T00:00:06
author: ranquild
comment: >-
Add report_card.public_uuid_prefix, a plaintext copy of the public_uuid's leading characters. public_uuid is
encrypted (non-deterministic), so it can't be matched with a SQL '='; this indexed prefix narrows a public-link
lookup to a handful of candidate rows that are then decrypted and compared in memory.
changes:
- addColumn:
tableName: report_card
columns:
- column:
name: public_uuid_prefix
type: varchar(36)
remarks: Plaintext leading characters of public_uuid, used as an indexed narrowing key for public-link lookups.
- changeSet:
id: v58.2026-08-25T00:00:07
author: ranquild
comment: >-
Add report_dashboard.public_uuid_prefix, a plaintext copy of the public_uuid's leading characters. public_uuid is
encrypted (non-deterministic), so it can't be matched with a SQL '='; this indexed prefix narrows a public-link
lookup to a handful of candidate rows that are then decrypted and compared in memory.
changes:
- addColumn:
tableName: report_dashboard
columns:
- column:
name: public_uuid_prefix
type: varchar(36)
remarks: Plaintext leading characters of public_uuid, used as an indexed narrowing key for public-link lookups.
- changeSet:
id: v58.2026-08-25T00:00:08
author: ranquild
comment: >-
Add action.public_uuid_prefix, a plaintext copy of the public_uuid's leading characters. public_uuid is
encrypted (non-deterministic), so it can't be matched with a SQL '='; this indexed prefix narrows a public-link
lookup to a handful of candidate rows that are then decrypted and compared in memory.
changes:
- addColumn:
tableName: action
columns:
- column:
name: public_uuid_prefix
type: varchar(36)
remarks: Plaintext leading characters of public_uuid, used as an indexed narrowing key for public-link lookups.
- changeSet:
id: v58.2026-08-25T00:00:09
author: ranquild
comment: >-
Add document.public_uuid_prefix, a plaintext copy of the public_uuid's leading characters. public_uuid is
encrypted (non-deterministic), so it can't be matched with a SQL '='; this indexed prefix narrows a public-link
lookup to a handful of candidate rows that are then decrypted and compared in memory.
changes:
- addColumn:
tableName: document
columns:
- column:
name: public_uuid_prefix
type: varchar(36)
remarks: Plaintext leading characters of public_uuid, used as an indexed narrowing key for public-link lookups.
- changeSet:
id: v58.2026-08-25T00:00:10
author: ranquild
comment: Add index on report_card.public_uuid_prefix for public-link lookups.
preConditions:
- onFail: MARK_RAN
- not:
- indexExists:
tableName: report_card
indexName: idx_report_card_public_uuid_prefix
changes:
- createIndex:
tableName: report_card
indexName: idx_report_card_public_uuid_prefix
columns:
- column:
name: public_uuid_prefix
- changeSet:
id: v58.2026-08-25T00:00:11
author: ranquild
comment: Add index on report_dashboard.public_uuid_prefix for public-link lookups.
preConditions:
- onFail: MARK_RAN
- not:
- indexExists:
tableName: report_dashboard
indexName: idx_report_dashboard_public_uuid_prefix
changes:
- createIndex:
tableName: report_dashboard
indexName: idx_report_dashboard_public_uuid_prefix
columns:
- column:
name: public_uuid_prefix
- changeSet:
id: v58.2026-08-25T00:00:12
author: ranquild
comment: Add index on action.public_uuid_prefix for public-link lookups.
preConditions:
- onFail: MARK_RAN
- not:
- indexExists:
tableName: action
indexName: idx_action_public_uuid_prefix
changes:
- createIndex:
tableName: action
indexName: idx_action_public_uuid_prefix
columns:
- column:
name: public_uuid_prefix
- changeSet:
id: v58.2026-08-25T00:00:13
author: ranquild
comment: Add index on document.public_uuid_prefix for public-link lookups.
preConditions:
- onFail: MARK_RAN
- not:
- indexExists:
tableName: document
indexName: idx_document_public_uuid_prefix
changes:
- createIndex:
tableName: document
indexName: idx_document_public_uuid_prefix
columns:
- column:
name: public_uuid_prefix
- changeSet:
id: v58.2026-08-25T00:00:14
author: ranquild
comment: >-
Backfill report_card.public_uuid_prefix from the leading 8 characters of the (still plaintext) public_uuid, so
existing public links keep resolving. Runs before EncryptPublicUuids, which then encrypts public_uuid
itself. 8 = public-sharing.core/public-uuid-prefix-length.
changes:
- sql: >-
UPDATE report_card SET public_uuid_prefix = SUBSTRING(public_uuid, 1, 8) WHERE public_uuid IS NOT NULL
rollback:
- sql: >-
UPDATE report_card SET public_uuid_prefix = NULL
- changeSet:
id: v58.2026-08-25T00:00:15
author: ranquild
comment: >-
Backfill report_dashboard.public_uuid_prefix from the leading 8 characters of the (still plaintext) public_uuid, so
existing public links keep resolving. Runs before EncryptPublicUuids, which then encrypts public_uuid
itself. 8 = public-sharing.core/public-uuid-prefix-length.
changes:
- sql: >-
UPDATE report_dashboard SET public_uuid_prefix = SUBSTRING(public_uuid, 1, 8) WHERE public_uuid IS NOT NULL
rollback:
- sql: >-
UPDATE report_dashboard SET public_uuid_prefix = NULL
- changeSet:
id: v58.2026-08-25T00:00:16
author: ranquild
comment: >-
Backfill action.public_uuid_prefix from the leading 8 characters of the (still plaintext) public_uuid, so
existing public links keep resolving. Runs before EncryptPublicUuids, which then encrypts public_uuid
itself. 8 = public-sharing.core/public-uuid-prefix-length.
changes:
- sql: >-
UPDATE action SET public_uuid_prefix = SUBSTRING(public_uuid, 1, 8) WHERE public_uuid IS NOT NULL
rollback:
- sql: >-
UPDATE action SET public_uuid_prefix = NULL
- changeSet:
id: v58.2026-08-25T00:00:17
author: ranquild
comment: >-
Backfill document.public_uuid_prefix from the leading 8 characters of the (still plaintext) public_uuid, so
existing public links keep resolving. Runs before EncryptPublicUuids, which then encrypts public_uuid
itself. 8 = public-sharing.core/public-uuid-prefix-length.
changes:
- sql: >-
UPDATE document SET public_uuid_prefix = SUBSTRING(public_uuid, 1, 8) WHERE public_uuid IS NOT NULL
rollback:
- sql: >-
UPDATE document SET public_uuid_prefix = NULL
- changeSet:
id: v58.2026-09-01T00:00:00
author: ranquild
comment: >-
Add setting.value_with_aad, which stores a setting's value encrypted under additional authenticated data naming
the setting (setting.<key>), so that a value moved between rows fails to decrypt: the bare value in
setting.value, or its ciphertext, says nothing about which setting it belongs to, and a direct DB write could
give one setting another's value. value is kept: this version writes both columns and reads only
value_with_aad, so a version that predates the column keeps working through a rolling upgrade, and a rollback
is just dropping value_with_aad again. The column is filled in from value after migrations, by
metabase.app-db.setting/migrate-settings!, which also repairs rows such a version has written since.
changes:
- addColumn:
tableName: setting
columns:
- column:
name: value_with_aad
type: ${text.type}
remarks: "The setting's value, encrypted under additional authenticated data naming the setting"
constraints:
nullable: true
- changeSet:
id: v58.2026-09-03T00:00:00
author: ranquild
comment: >-
Forget the changelog records of the Encrypt* backfill changesets this release removes: encrypting a value that a
previous version stored unencrypted is the startup sweep's job, and a one-shot migration cannot be relied on to
have done it. Keeps the changelog table in step with the changelog; a database that has not run them is
unaffected either way.
changes:
- sql:
sql: DELETE FROM ${databasechangelog.name} WHERE id IN ('v58.2026-08-25T00:00:00', 'v58.2026-08-25T00:00:01', 'v58.2026-08-25T00:00:18', 'v58.2026-08-25T00:00:19', 'v58.2026-08-28T00:00:00', 'v58.2026-08-28T14:00:00', 'v58.2026-08-30T00:00:00');
rollback: []
- changeSet:
id: v58.2026-09-03T00:00:03
author: ranquild
comment: >-
Delete the plaintext "unencrypted" encryption-check marker that v53.2024-12-27T17:33:54 inserted on every new
database, encrypted ones included, so it said nothing about the actual state. With no row the state is unknown
and is judged from the content; the encryption tooling writes the sentinel itself when the state changes.
changes:
- sql:
dbms: postgresql
sql: DELETE FROM setting WHERE "key" = 'encryption-check' AND value = 'unencrypted';
- sql:
dbms: mysql,mariadb
sql: DELETE FROM setting WHERE `key` = 'encryption-check' AND value = 'unencrypted';
- sql:
dbms: h2
sql: DELETE FROM setting WHERE "KEY" = 'encryption-check' AND "VALUE" = 'unencrypted';
rollback: []
- changeSet:
id: v58.2026-09-03T00:00:04
author: ranquild
comment: Fill setting.value_with_aad for the example-dashboard-id row CreateSampleContentV2 wrote before the column existed
changes:
- customChange:
class: "metabase.app_db.custom_migrations.BackfillExampleDashboardIdValueWithAad"
- changeSet:
id: v58.2026-09-15T00:00:00
author: Bryan Maass
comment: Add saml_session_index to core_session
changes:
- addColumn:
tableName: core_session
columns:
- column:
name: saml_session_index
type: varchar(254)
remarks: SessionIndex from the SAML login assertion, sent back in the SLO LogoutRequest to identify this session. NULL for non-SAML sessions and for sessions created before this column existed.
constraints:
nullable: true
rollback:
- dropColumn:
tableName: core_session
columnName: saml_session_index
- changeSet:
id: v58.2026-09-15T00:00:01
author: Bryan Maass
comment: Add saml_name_id to core_session
changes:
- addColumn:
tableName: core_session
columns:
- column:
name: saml_name_id
type: varchar(254)
remarks: NameID from the SAML login assertion. Sent back in the SLO LogoutRequest, since the IdP identifies the subject by this and not by email. NULL for non-SAML sessions.
constraints:
nullable: true
rollback:
- dropColumn:
tableName: core_session
columnName: saml_name_id
- changeSet:
id: v58.2026-09-15T00:00:02
author: Bryan Maass
comment: Add saml_name_id_format to core_session
changes:
- addColumn:
tableName: core_session
columns:
- column:
name: saml_name_id_format
type: varchar(254)
remarks: Format attribute of the SAML NameID. Echoed back in the LogoutRequest because some IdPs compare it literally. NULL when the IdP sent none.
constraints:
nullable: true
rollback:
- dropColumn:
tableName: core_session
columnName: saml_name_id_format
- changeSet:
id: v58.2026-10-29T00:00:00
author: ranquild
comment: Add impersonation_query_cache
changes:
- createTable:
tableName: impersonation_query_cache
remarks: Cached validation results of native query stages run on impersonated databases
columns:
- column:
name: id
type: int
autoIncrement: true
constraints:
primaryKey: true
nullable: false
primaryKeyName: pk_impersonation_query_cache
- column:
name: input_version
type: varchar(255)
remarks: Metabase version that validated the query; rows from other versions are never read
constraints:
nullable: false
- column:
name: input_engine
type: varchar(254)
remarks: Driver that validated the query
constraints:
nullable: false
- column:
name: input_allow_write
type: ${boolean.type}
remarks: Whether the query was validated as a write statement rather than a select
constraints:
nullable: false
- column:
name: input_admin
type: ${boolean.type}
remarks: Whether the query was validated for an admin, who is allowed more than other users
constraints:
nullable: false
- column:
name: input_query_hash
type: varchar(64)
remarks: SHA-256 hex of input_query, used to look the row up
constraints:
nullable: false
- column:
name: input_query
type: ${text.type}
remarks: Native SQL of the stage after parameter substitution
constraints:
nullable: false
- column:
name: result
type: varchar(32)
remarks: 'Validation outcome: valid, unparseable, unvalidatable or invalid'
constraints:
nullable: false
- column:
name: result_query
type: ${text.type}
remarks: Validated SQL to run in place of input_query, set only when result is valid
constraints:
nullable: true
- column:
name: result_reason
type: varchar(64)
remarks: Why the validator could not check the query, when it says
constraints:
nullable: true
- column:
name: created_at
type: ${timestamp_type}
remarks: Timestamp when the result was cached
constraints:
nullable: false
- changeSet:
id: v58.2026-10-29T00:00:01
author: ranquild
comment: Add the lookup key of impersonation_query_cache
changes:
- addUniqueConstraint:
tableName: impersonation_query_cache
columnNames: input_query_hash, input_engine, input_allow_write, input_admin, input_version
constraintName: uq_impersonation_query_cache_input
# >>>>>>>>>> DO NOT ADD NEW MIGRATIONS BELOW THIS LINE! ADD THEM ABOVE <<<<<<<<<<
########################################################################################################################
#
# ADVICE:
#
# 1) Think through some of these points when writing a migration, learn from our past mistakes:
# - Do you really need a migration? Could the feature work without it? Prefer not to if possible.
# Data in the wild can be vastly different from what you expect, and it's hard to get right.
# - Make sure your migration is backward compatible: it might not be possible to add a constraint back
# if you drop it in a migration.
# - Postgres, MySQL and H2 have their differences. Make sure your migration works for all.
# - Database encryption is a major issue:
# - Fields like `metabase_database.details` or `setting.value` can be encrypted, so you need to decrypt them in
# your migration. See #42617, #44048.
# - Database could be partially encrypted, see https://www.notion.so/72575933ef2a446bafd16909e05a7387
# - Custom migrations:
# - Prefer SQL migrations when possible.
# - Never use application code: it can change and *will* break your migration.
# - Do not use Toucan models - refer table names directly.
# - If it's a big change, consider using Quartz, see #42279
# - More in `metabase.app_db.custom_migrations` namespace doc.
# - Never delete a migration: users won't be able to downgrade. If you really need to, see #44908
# - Migration id (`vXX.<date>`) must match its earliest released version:
# - Do not backport `v51....` to version 50, Metabase will try to downgrade it.
# - Instead, write a migration with an oldest target you plan to backport to in mind.
#
# 2) Migrations should go in the ###_update_migrations.yaml file for the target version.
#
# 3) Run mage lint-migrations to run core.spec checks against any changes you make here. Liquibase is pretty
# forgiving and won't complain if you accidentally mix up things like deleteCascade and onDelete: CASCADE. CI runs
# this check but it's nicer to know now instead of waiting for CI.
#
# 3) Migration IDs should follow the format
#
# vMM.TIMESTAMP
#
# Where
#
# M = major version
# TIMESTAMP = the current timestamp with format `yyyy-MM-dd'T'HH:mm:ss`
# To get this timestamp, evaluate this in your REPL: `(dev/migration-timestamp)`
#
# E.g: You're adding a new migration for version 49, And it's 10:30:00AM on April 1, 2023 (UTC),
# your migration id should be: `v49.2023-04-01T10:30:00`.
#
# PLEASE KEEP THIS MESSAGE AT THE BOTTOM OF THIS FILE!!!!! Add new migrations above the message.
#
########################################################################################################################