Brandon Presley
1bc145f60c
Since we are swapping from the old system to this system sometimes the columns will be already existing. These errors failing are OK since we haven't changed any column types before.
21 lines
585 B
TypeScript
21 lines
585 B
TypeScript
import {MigrationInterface, QueryRunner} from 'typeorm'
|
|
|
|
export class Sets1667185586014 implements MigrationInterface {
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`
|
|
CREATE TABLE IF NOT EXISTS sets (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
name TEXT NOT NULL,
|
|
reps INTEGER NOT NULL,
|
|
weight INTEGER NOT NULL,
|
|
created TEXT NOT NULL,
|
|
unit TEXT DEFAULT 'kg'
|
|
)
|
|
`)
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`DROP TABLE sets`)
|
|
}
|
|
}
|