1689672099828-add-notifications.ts 852 B

1234567891011121314151617
  1. import { MigrationInterface, QueryRunner } from 'typeorm'
  2. export class AddNotifications1689672099828 implements MigrationInterface {
  3. name = 'AddNotifications1689672099828'
  4. public async up(queryRunner: QueryRunner): Promise<void> {
  5. await queryRunner.query(
  6. 'CREATE TABLE IF NOT EXISTS "notifications" ("uuid" varchar PRIMARY KEY NOT NULL, "user_uuid" varchar(36) NOT NULL, "type" varchar(36) NOT NULL, "payload" text NOT NULL, "created_at_timestamp" bigint NOT NULL, "updated_at_timestamp" bigint NOT NULL)',
  7. )
  8. await queryRunner.query('CREATE INDEX "index_notifications_on_user_uuid" ON "notifications" ("user_uuid") ')
  9. }
  10. public async down(queryRunner: QueryRunner): Promise<void> {
  11. await queryRunner.query('DROP INDEX "index_notifications_on_user_uuid"')
  12. await queryRunner.query('DROP TABLE "notifications"')
  13. }
  14. }