mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-23 09:35:02 +00:00
DB optimizations
This commit is contained in:
parent
80f6f69ccd
commit
a6e650810c
2 changed files with 66 additions and 0 deletions
|
@ -0,0 +1,21 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class OptimizeMessageTimestamps1591038041635 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<any> {
|
||||
// DATETIME(3) -> DATETIME(0)
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`messages\`
|
||||
CHANGE COLUMN \`posted_at\` \`posted_at\` DATETIME(0) NOT NULL AFTER \`data\`,
|
||||
CHANGE COLUMN \`deleted_at\` \`deleted_at\` DATETIME(0) NULL DEFAULT NULL AFTER \`posted_at\`
|
||||
`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<any> {
|
||||
// DATETIME(0) -> DATETIME(3)
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`messages\`
|
||||
CHANGE COLUMN \`posted_at\` \`posted_at\` DATETIME(3) NOT NULL AFTER \`data\`,
|
||||
CHANGE COLUMN \`deleted_at\` \`deleted_at\` DATETIME(3) NULL DEFAULT NULL AFTER \`posted_at\`
|
||||
`);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue