recommend/prisma/migrations/20240530162224_bigint/migration.sql
2024-05-30 12:22:44 -05:00

26 lines
1.2 KiB
SQL

/*
Warnings:
- You are about to alter the column `best_id` on the `Score` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`.
- You are about to alter the column `score_id` on the `Score` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`.
*/
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_Score" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"accuracy" REAL NOT NULL,
"best_id" BIGINT,
"created_at" DATETIME NOT NULL,
"score_id" BIGINT,
"score" INTEGER NOT NULL,
"beatmap_id" INTEGER NOT NULL,
"beatmapset_id" INTEGER NOT NULL,
"user_id" INTEGER NOT NULL
);
INSERT INTO "new_Score" ("accuracy", "beatmap_id", "beatmapset_id", "best_id", "created_at", "id", "score", "score_id", "user_id") SELECT "accuracy", "beatmap_id", "beatmapset_id", "best_id", "created_at", "id", "score", "score_id", "user_id" FROM "Score";
DROP TABLE "Score";
ALTER TABLE "new_Score" RENAME TO "Score";
CREATE UNIQUE INDEX "Score_user_id_beatmap_id_created_at_score_key" ON "Score"("user_id", "beatmap_id", "created_at", "score");
PRAGMA foreign_key_check("Score");
PRAGMA foreign_keys=ON;