2022-05-16 09:19:33 -07:00
|
|
|
import { MigrationInterface, QueryRunner } from 'typeorm';
|
2022-11-09 06:25:00 -08:00
|
|
|
import config from '@/config';
|
2022-05-16 09:19:33 -07:00
|
|
|
|
|
|
|
export class AddUserSettings1652367743993 implements MigrationInterface {
|
|
|
|
name = 'AddUserSettings1652367743993';
|
|
|
|
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
|
|
const tablePrefix = config.getEnv('database.tablePrefix');
|
|
|
|
|
|
|
|
await queryRunner.query(
|
|
|
|
'ALTER TABLE `' + tablePrefix + 'user` ADD COLUMN `settings` json NULL DEFAULT NULL',
|
|
|
|
);
|
|
|
|
await queryRunner.query(
|
|
|
|
'ALTER TABLE `' +
|
|
|
|
tablePrefix +
|
|
|
|
'user` CHANGE COLUMN `personalizationAnswers` `personalizationAnswers` json NULL DEFAULT NULL',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
|
|
const tablePrefix = config.getEnv('database.tablePrefix');
|
|
|
|
|
|
|
|
await queryRunner.query('ALTER TABLE `' + tablePrefix + 'user` DROP COLUMN `settings`');
|
|
|
|
}
|
|
|
|
}
|