1
0
Fork 0
mirror of synced 2024-06-01 18:20:18 +12:00
budibase/packages/types/src/sdk/migrations.ts
2022-09-28 13:13:37 +01:00

55 lines
1.3 KiB
TypeScript

export interface Migration extends MigrationDefinition {
appOpts?: object
fn: Function
silent?: boolean
preventRetry?: boolean
}
export enum MigrationType {
// run once per tenant, recorded in global db, global db is provided as an argument
GLOBAL = "global",
// run per app, recorded in each app db, app db is provided as an argument
APP = "app",
// run once, recorded in global info db, global info db is provided as an argument
INSTALLATION = "installation",
}
export interface MigrationNoOpOptions {
type: MigrationType
tenantId: string
appId?: string
}
/**
* e.g.
* {
* tenantIds: ['bb'],
* force: {
* global: ['quota_1']
* }
* }
*/
export interface MigrationOptions {
tenantIds?: string[]
force?: {
[type: string]: string[]
}
noOp?: MigrationNoOpOptions
}
export enum MigrationName {
USER_EMAIL_VIEW_CASING = "user_email_view_casing",
APP_URLS = "app_urls",
EVENT_APP_BACKFILL = "event_app_backfill",
EVENT_GLOBAL_BACKFILL = "event_global_backfill",
EVENT_INSTALLATION_BACKFILL = "event_installation_backfill",
GLOBAL_INFO_SYNC_USERS = "global_info_sync_users",
// increment this number to re-activate this migration
SYNC_QUOTAS = "sync_quotas_1",
}
export interface MigrationDefinition {
type: MigrationType
name: MigrationName
}