initial
[sketchy-heroes.git] / prisma / migrations / 20220314040343_unsure / migration.sql
1 /*
2   Warnings:
3
4   - You are about to drop the column `player_id` on the `AuthToken` table. All the data in the column will be lost.
5   - You are about to drop the column `stat_points` on the `Player` table. All the data in the column will be lost.
6   - A unique constraint covering the columns `[playerId]` on the table `AuthToken` will be added. If there are existing duplicate values, this will fail.
7   - Added the required column `playerId` to the `AuthToken` table without a default value. This is not possible if the table is not empty.
8
9 */
10 -- DropForeignKey
11 ALTER TABLE "AuthToken" DROP CONSTRAINT "AuthToken_player_id_fkey";
12
13 -- DropIndex
14 DROP INDEX "AuthToken_player_id_key";
15
16 -- AlterTable
17 ALTER TABLE "AuthToken" DROP COLUMN "player_id",
18 ADD COLUMN     "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
19 ADD COLUMN     "playerId" UUID NOT NULL,
20 ADD COLUMN     "updatedAt" TIMESTAMP(3);
21
22 -- AlterTable
23 ALTER TABLE "Player" DROP COLUMN "stat_points",
24 ADD COLUMN     "statPoints" INTEGER NOT NULL DEFAULT 0;
25
26 -- CreateIndex
27 CREATE UNIQUE INDEX "AuthToken_playerId_key" ON "AuthToken"("playerId");
28
29 -- AddForeignKey
30 ALTER TABLE "AuthToken" ADD CONSTRAINT "AuthToken_playerId_fkey" FOREIGN KEY ("playerId") REFERENCES "Player"("id") ON DELETE RESTRICT ON UPDATE CASCADE;