Add migration to drop old migrations table
This commit is contained in:
parent
eafad1f47e
commit
bd6b20fb4e
|
@ -1,6 +1,6 @@
|
||||||
import {DataSource} from 'typeorm'
|
import {DataSource} from 'typeorm'
|
||||||
import GymSet from './gym-set'
|
import GymSet from './gym-set'
|
||||||
import {Sets1667185586014} from './migrations/1667185586014-sets'
|
import {Sets1667185586014 as sets1667185586014} from './migrations/1667185586014-sets'
|
||||||
import {plans1667186124792} from './migrations/1667186124792-plans'
|
import {plans1667186124792} from './migrations/1667186124792-plans'
|
||||||
import {settings1667186130041} from './migrations/1667186130041-settings'
|
import {settings1667186130041} from './migrations/1667186130041-settings'
|
||||||
import {addSound1667186139844} from './migrations/1667186139844-add-sound'
|
import {addSound1667186139844} from './migrations/1667186139844-add-sound'
|
||||||
|
@ -22,6 +22,7 @@ import {addTheme1667186439366} from './migrations/1667186439366-add-theme'
|
||||||
import {addShowSets1667186443614} from './migrations/1667186443614-add-show-sets'
|
import {addShowSets1667186443614} from './migrations/1667186443614-add-show-sets'
|
||||||
import {addSetsCreated1667186451005} from './migrations/1667186451005-add-sets-created'
|
import {addSetsCreated1667186451005} from './migrations/1667186451005-add-sets-created'
|
||||||
import {addNoSound1667186456118} from './migrations/1667186456118-add-no-sound'
|
import {addNoSound1667186456118} from './migrations/1667186456118-add-no-sound'
|
||||||
|
import {dropMigrations1667190214743} from './migrations/1667190214743-drop-migrations'
|
||||||
import {Plan} from './plan'
|
import {Plan} from './plan'
|
||||||
import Settings from './settings'
|
import Settings from './settings'
|
||||||
|
|
||||||
|
@ -30,9 +31,10 @@ export const AppDataSource = new DataSource({
|
||||||
database: 'massive.db',
|
database: 'massive.db',
|
||||||
location: 'default',
|
location: 'default',
|
||||||
entities: [GymSet, Plan, Settings],
|
entities: [GymSet, Plan, Settings],
|
||||||
|
migrationsRun: true,
|
||||||
migrationsTableName: 'typeorm_migrations',
|
migrationsTableName: 'typeorm_migrations',
|
||||||
migrations: [
|
migrations: [
|
||||||
Sets1667185586014,
|
sets1667185586014,
|
||||||
plans1667186124792,
|
plans1667186124792,
|
||||||
settings1667186130041,
|
settings1667186130041,
|
||||||
addSound1667186139844,
|
addSound1667186139844,
|
||||||
|
@ -54,5 +56,6 @@ export const AppDataSource = new DataSource({
|
||||||
addShowSets1667186443614,
|
addShowSets1667186443614,
|
||||||
addSetsCreated1667186451005,
|
addSetsCreated1667186451005,
|
||||||
addNoSound1667186456118,
|
addNoSound1667186456118,
|
||||||
|
dropMigrations1667190214743,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
19
migrations/1667190214743-drop-migrations.ts
Normal file
19
migrations/1667190214743-drop-migrations.ts
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
import {MigrationInterface, QueryRunner, Table, TableColumn} from 'typeorm'
|
||||||
|
|
||||||
|
export class dropMigrations1667190214743 implements MigrationInterface {
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.dropTable('migrations').catch(() => null)
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.createTable(
|
||||||
|
new Table({
|
||||||
|
name: 'migrations',
|
||||||
|
columns: [
|
||||||
|
new TableColumn({name: 'id', type: 'integer'}),
|
||||||
|
new TableColumn({name: 'command', type: 'text'}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user