1
0
Fork 0
mirror of synced 2024-06-30 20:10:54 +12:00
budibase/packages/server/src/migrations/index.ts

49 lines
896 B
TypeScript
Raw Normal View History

2022-01-24 23:48:59 +13:00
import CouchDB from "../db"
const {
MIGRATION_TYPES,
runMigrations,
} = require("@budibase/backend-core/migrations")
// migration functions
import * as userEmailViewCasing from "./functions/userEmailViewCasing"
import * as quota1 from "./functions/quotas1"
export interface Migration {
type: string
name: string
fn: Function
}
/**
* e.g.
* {
* tenantIds: ['bb'],
* force: {
* global: ['quota_1']
* }
* }
*/
export interface MigrationOptions {
tenantIds?: string[]
forced?: {
[type: string]: string[]
}
}
const MIGRATIONS: Migration[] = [
{
type: MIGRATION_TYPES.GLOBAL,
name: "user_email_view_casing",
fn: userEmailViewCasing.run,
},
{
type: MIGRATION_TYPES.GLOBAL,
name: "quotas_1",
fn: quota1.run,
},
]
export const migrate = async (options?: MigrationOptions) => {
await runMigrations(CouchDB, MIGRATIONS, options)
}