forked from noxious/server
code update
This commit is contained in:
46
prisma/migrations/20240509150033_init/migration.sql
Normal file
46
prisma/migrations/20240509150033_init/migration.sql
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `mapId` on the `Chatlogs` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `mapId` on the `User` table. All the data in the column will be lost.
|
||||
- You are about to drop the `Map` table. If the table is not empty, all the data it contains will be lost.
|
||||
- A unique constraint covering the columns `[zoneId]` on the table `User` will be added. If there are existing duplicate values, this will fail.
|
||||
- Added the required column `zoneId` to the `Chatlogs` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `Chatlogs` DROP FOREIGN KEY `Chatlogs_mapId_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `User` DROP FOREIGN KEY `User_mapId_fkey`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Chatlogs` DROP COLUMN `mapId`,
|
||||
ADD COLUMN `zoneId` INTEGER NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `User` DROP COLUMN `mapId`,
|
||||
ADD COLUMN `zoneId` INTEGER NULL;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE `Map`;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `Zone` (
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(191) NOT NULL,
|
||||
`width` INTEGER NOT NULL,
|
||||
`height` INTEGER NOT NULL,
|
||||
`tiles` JSON NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `User_zoneId_key` ON `User`(`zoneId`);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `User` ADD CONSTRAINT `User_zoneId_fkey` FOREIGN KEY (`zoneId`) REFERENCES `Zone`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Chatlogs` ADD CONSTRAINT `Chatlogs_zoneId_fkey` FOREIGN KEY (`zoneId`) REFERENCES `Zone`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
@ -26,12 +26,12 @@ model User {
|
||||
position_x Int?
|
||||
position_y Int?
|
||||
rotation Int?
|
||||
mapId Int? @unique
|
||||
map Map? @relation(fields: [mapId], references: [id])
|
||||
zoneId Int? @unique
|
||||
zone Zone? @relation(fields: [zoneId], references: [id])
|
||||
chatlogs Chatlogs[]
|
||||
}
|
||||
|
||||
model Map {
|
||||
model Zone {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
width Int
|
||||
@ -45,7 +45,7 @@ model Chatlogs {
|
||||
id Int @id @default(autoincrement())
|
||||
userId Int
|
||||
message String
|
||||
mapId Int
|
||||
map Map @relation(fields: [mapId], references: [id])
|
||||
zoneId Int
|
||||
zone Zone @relation(fields: [zoneId], references: [id])
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
}
|
Reference in New Issue
Block a user