You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
www/src/app/migrations/2023-11-08T01:49:09.928Z_Ad...

44 lines
1.0 KiB

import {Injectable, Migration, Inject, DatabaseService, FieldType} from '@extollo/lib'
/**
* AddCoreidColumnsToUsersTableMigration
* ----------------------------------
* Put some description here.
*/
@Injectable()
export default class AddCoreidColumnsToUsersTableMigration extends Migration {
@Inject()
protected readonly db!: DatabaseService
/**
* Apply the migration.
*/
async up(): Promise<void> {
const schema = this.db.get().schema()
const table = await schema.table('users')
table.column('tagline')
.type(FieldType.varchar)
.nullable()
table.column('photo_url')
.type(FieldType.varchar)
.nullable()
await schema.commit(table)
}
/**
* Undo the migration.
*/
async down(): Promise<void> {
const schema = this.db.get().schema()
const table = await schema.table('users')
table.dropColumn('tagline')
table.dropColumn('photo_url')
await schema.commit(table)
}
}