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` (
|
CREATE TABLE `ZoneEventTile` (
|
||||||
`id` VARCHAR(191) NOT NULL,
|
`id` VARCHAR(191) NOT NULL,
|
||||||
`zoneId` INTEGER 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_x` INTEGER NOT NULL,
|
||||||
`position_y` 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`)
|
PRIMARY KEY (`id`)
|
||||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||||
@ -201,3 +213,9 @@ ALTER TABLE `ZoneObject` ADD CONSTRAINT `ZoneObject_objectId_fkey` FOREIGN KEY (
|
|||||||
|
|
||||||
-- AddForeignKey
|
-- AddForeignKey
|
||||||
ALTER TABLE `ZoneEventTile` ADD CONSTRAINT `ZoneEventTile_zoneId_fkey` FOREIGN KEY (`zoneId`) REFERENCES `Zone`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
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 {
|
model Zone {
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
name String
|
name String
|
||||||
width Int @default(10)
|
width Int @default(10)
|
||||||
height Int @default(10)
|
height Int @default(10)
|
||||||
tiles Json?
|
tiles Json?
|
||||||
pvp Boolean @default(false)
|
pvp Boolean @default(false)
|
||||||
zoneEventTiles ZoneEventTile[]
|
zoneEventTiles ZoneEventTile[]
|
||||||
zoneObjects ZoneObject[]
|
zoneEventTileTeleports ZoneEventTileTeleport[]
|
||||||
characters Character[]
|
zoneObjects ZoneObject[]
|
||||||
chats Chat[]
|
characters Character[]
|
||||||
createdAt DateTime @default(now())
|
chats Chat[]
|
||||||
updatedAt DateTime @updatedAt
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
}
|
}
|
||||||
|
|
||||||
model ZoneObject {
|
model ZoneObject {
|
||||||
@ -59,16 +60,27 @@ model ZoneObject {
|
|||||||
|
|
||||||
enum ZoneEventTileType {
|
enum ZoneEventTileType {
|
||||||
BLOCK
|
BLOCK
|
||||||
WARP
|
TELEPORT
|
||||||
NPC
|
NPC
|
||||||
ITEM
|
ITEM
|
||||||
}
|
}
|
||||||
|
|
||||||
model ZoneEventTile {
|
model ZoneEventTile {
|
||||||
id String @id @default(uuid())
|
id String @id @default(uuid())
|
||||||
zoneId Int
|
zoneId Int
|
||||||
zone Zone @relation(fields: [zoneId], references: [id], onDelete: Cascade)
|
zone Zone @relation(fields: [zoneId], references: [id], onDelete: Cascade)
|
||||||
type ZoneEventTileType
|
type ZoneEventTileType
|
||||||
position_x Int
|
position_x Int
|
||||||
position_y 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