import { Migration } from '@mikro-orm/migrations';

export class Migration20240515170000 extends Migration {
    async up(): Promise<void> {
        this.addSql(`
      CREATE TABLE IF NOT EXISTS "canvas_api_endpoints" (
        "id" serial PRIMARY KEY,
        "created_at" timestamptz(0) NOT NULL DEFAULT now(),
        "updated_at" timestamptz(0) NOT NULL DEFAULT now(),
        "name" varchar(255) NOT NULL,
        "method" varchar(255) NOT NULL,
        "path" varchar(255) NOT NULL,
        "description" varchar(255),
        "user_id" int,
        "public_path" varchar(255),
        CONSTRAINT "canvas_api_endpoints_user_id_foreign" FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON UPDATE CASCADE ON DELETE SET NULL
      );
    `);
    }
} 