Files
Toju/server/src/migrations/1000000000010-DeviceTokens.ts

24 lines
778 B
TypeScript

import { MigrationInterface, QueryRunner } from 'typeorm';
export class DeviceTokens1000000000010 implements MigrationInterface {
name = 'DeviceTokens1000000000010';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
CREATE TABLE IF NOT EXISTS "device_tokens" (
"id" TEXT PRIMARY KEY NOT NULL,
"userId" TEXT NOT NULL,
"platform" TEXT NOT NULL,
"token" TEXT NOT NULL,
"updatedAt" INTEGER NOT NULL
)
`);
await queryRunner.query(`CREATE INDEX IF NOT EXISTS "idx_device_tokens_user_id" ON "device_tokens" ("userId")`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP TABLE IF EXISTS "device_tokens"`);
}
}