recommend/prisma/migrations/20240530165947_a/migration.sql

35 lines
1.6 KiB
MySQL
Raw Permalink Normal View History

2024-05-30 17:22:44 +00:00
/*
Warnings:
- You are about to drop the column `genre` on the `BeatmapSet` table. All the data in the column will be lost.
- You are about to drop the column `language` on the `BeatmapSet` table. All the data in the column will be lost.
- Added the required column `beatmapset_id` to the `Beatmap` table without a default value. This is not possible if the table is not empty.
- Added the required column `ranked` to the `BeatmapSet` table without a default value. This is not possible if the table is not empty.
*/
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_Beatmap" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"difficulty" TEXT NOT NULL,
"beatmapset_id" INTEGER NOT NULL,
CONSTRAINT "Beatmap_beatmapset_id_fkey" FOREIGN KEY ("beatmapset_id") REFERENCES "BeatmapSet" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_Beatmap" ("difficulty", "id") SELECT "difficulty", "id" FROM "Beatmap";
DROP TABLE "Beatmap";
ALTER TABLE "new_Beatmap" RENAME TO "Beatmap";
CREATE TABLE "new_BeatmapSet" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"artist" TEXT NOT NULL,
"artistUnicode" TEXT NOT NULL,
"title" TEXT NOT NULL,
"titleUnicode" TEXT NOT NULL,
"ranked" BOOLEAN NOT NULL
);
INSERT INTO "new_BeatmapSet" ("artist", "artistUnicode", "id", "title", "titleUnicode") SELECT "artist", "artistUnicode", "id", "title", "titleUnicode" FROM "BeatmapSet";
DROP TABLE "BeatmapSet";
ALTER TABLE "new_BeatmapSet" RENAME TO "BeatmapSet";
PRAGMA foreign_key_check("Beatmap");
PRAGMA foreign_key_check("BeatmapSet");
PRAGMA foreign_keys=ON;