Updated Prisma models for storing zone event tile teleport data
This commit is contained in:
parent
6b97e7d9cb
commit
ff7664bae0
@ -159,9 +159,21 @@ CREATE TABLE `ZoneObject` (
|
||||
CREATE TABLE `ZoneEventTile` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`zoneId` INTEGER NOT NULL,
|
||||
`type` ENUM('BLOCK', 'WARP', 'NPC', 'ITEM') NOT NULL,
|
||||
`type` ENUM('BLOCK', 'TELEPORT', 'NPC', 'ITEM') NOT NULL,
|
||||
`position_x` INTEGER NOT NULL,
|
||||
`position_y` INTEGER NOT NULL,
|
||||
`teleportId` VARCHAR(191) NULL,
|
||||
|
||||
UNIQUE INDEX `ZoneEventTile_teleportId_key`(`teleportId`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `ZoneEventTileTeleport` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`toZoneId` INTEGER NOT NULL,
|
||||
`toPosition_x` INTEGER NOT NULL,
|
||||
`toPosition_y` INTEGER NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
@ -201,3 +213,9 @@ ALTER TABLE `ZoneObject` ADD CONSTRAINT `ZoneObject_objectId_fkey` FOREIGN KEY (
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `ZoneEventTile` ADD CONSTRAINT `ZoneEventTile_zoneId_fkey` FOREIGN KEY (`zoneId`) REFERENCES `Zone`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `ZoneEventTile` ADD CONSTRAINT `ZoneEventTile_teleportId_fkey` FOREIGN KEY (`teleportId`) REFERENCES `ZoneEventTileTeleport`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `ZoneEventTileTeleport` ADD CONSTRAINT `ZoneEventTileTeleport_toZoneId_fkey` FOREIGN KEY (`toZoneId`) REFERENCES `Zone`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
@ -32,18 +32,19 @@ model Item {
|
||||
}
|
||||
|
||||
model Zone {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
width Int @default(10)
|
||||
height Int @default(10)
|
||||
tiles Json?
|
||||
pvp Boolean @default(false)
|
||||
zoneEventTiles ZoneEventTile[]
|
||||
zoneObjects ZoneObject[]
|
||||
characters Character[]
|
||||
chats Chat[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
width Int @default(10)
|
||||
height Int @default(10)
|
||||
tiles Json?
|
||||
pvp Boolean @default(false)
|
||||
zoneEventTiles ZoneEventTile[]
|
||||
zoneEventTileTeleports ZoneEventTileTeleport[]
|
||||
zoneObjects ZoneObject[]
|
||||
characters Character[]
|
||||
chats Chat[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model ZoneObject {
|
||||
@ -59,16 +60,27 @@ model ZoneObject {
|
||||
|
||||
enum ZoneEventTileType {
|
||||
BLOCK
|
||||
WARP
|
||||
TELEPORT
|
||||
NPC
|
||||
ITEM
|
||||
}
|
||||
|
||||
model ZoneEventTile {
|
||||
id String @id @default(uuid())
|
||||
id String @id @default(uuid())
|
||||
zoneId Int
|
||||
zone Zone @relation(fields: [zoneId], references: [id], onDelete: Cascade)
|
||||
zone Zone @relation(fields: [zoneId], references: [id], onDelete: Cascade)
|
||||
type ZoneEventTileType
|
||||
position_x Int
|
||||
position_y Int
|
||||
teleportId String? @unique
|
||||
teleport ZoneEventTileTeleport? @relation("ZoneEventTileTeleport", fields: [teleportId], references: [id])
|
||||
}
|
||||
|
||||
model ZoneEventTileTeleport {
|
||||
id String @id @default(uuid())
|
||||
zoneEventTile ZoneEventTile? @relation("ZoneEventTileTeleport")
|
||||
toZoneId Int
|
||||
toZone Zone @relation(fields: [toZoneId], references: [id], onDelete: Cascade)
|
||||
toPosition_x Int
|
||||
toPosition_y Int
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user