|
1
|
import { Migration } from "@medusajs/framework/mikro-orm/migrations" |
|
2
|
|
|
3
|
export class Migration20241209173313 extends Migration { |
|
4
|
async up(): Promise<void> { |
|
5
|
this.addSql(` |
|
6
|
ALTER TABLE "index_data" |
|
7
|
ADD COLUMN IF NOT EXISTS "created_at" timestamptz NOT NULL DEFAULT now(), |
|
8
|
ADD COLUMN IF NOT EXISTS "updated_at" timestamptz NOT NULL DEFAULT now(), |
|
9
|
ADD COLUMN IF NOT EXISTS "deleted_at" timestamptz NULL; |
|
10
|
`) |
|
11
|
|
|
12
|
this.addSql(` |
|
13
|
ALTER TABLE "index_relation" |
|
14
|
ADD COLUMN IF NOT EXISTS "created_at" timestamptz NOT NULL DEFAULT now(), |
|
15
|
ADD COLUMN IF NOT EXISTS "updated_at" timestamptz NOT NULL DEFAULT now(), |
|
16
|
ADD COLUMN IF NOT EXISTS "deleted_at" timestamptz NULL; |
|
17
|
`) |
|
18
|
} |
|
19
|
|
|
20
|
async down(): Promise<void> { |
|
21
|
this.addSql(` |
|
22
|
ALTER TABLE "index_data" |
|
23
|
DROP COLUMN IF EXISTS "created_at", |
|
24
|
DROP COLUMN IF EXISTS "updated_at", |
|
25
|
DROP COLUMN IF EXISTS "deleted_at"; |
|
26
|
`) |
|
27
|
|
|
28
|
this.addSql(` |
|
29
|
ALTER TABLE "index_relation" |
|
30
|
DROP COLUMN IF EXISTS "created_at", |
|
31
|
DROP COLUMN IF EXISTS "updated_at", |
|
32
|
DROP COLUMN IF EXISTS "deleted_at"; |
|
33
|
`) |
|
34
|
} |
|
35
|
} |