This commit is contained in:
2024-08-22 20:00:37 +02:00
parent ff7664bae0
commit c4b50ec811
16 changed files with 97 additions and 80 deletions

View File

@ -25,8 +25,8 @@ CREATE TABLE `SpriteAction` (
`spriteId` VARCHAR(191) NOT NULL,
`action` VARCHAR(191) NOT NULL,
`sprites` JSON NULL,
`origin_x` DECIMAL(65, 30) NOT NULL DEFAULT 0,
`origin_y` DECIMAL(65, 30) NOT NULL DEFAULT 0,
`originX` DECIMAL(65, 30) NOT NULL DEFAULT 0,
`originY` DECIMAL(65, 30) NOT NULL DEFAULT 0,
`isAnimated` BOOLEAN NOT NULL DEFAULT false,
`isLooping` BOOLEAN NOT NULL DEFAULT false,
`frameWidth` INTEGER NOT NULL DEFAULT 0,
@ -69,8 +69,8 @@ CREATE TABLE `Character` (
`level` INTEGER NOT NULL DEFAULT 1,
`experience` INTEGER NOT NULL DEFAULT 0,
`role` VARCHAR(191) NOT NULL DEFAULT 'player',
`position_x` INTEGER NOT NULL DEFAULT 0,
`position_y` INTEGER NOT NULL DEFAULT 0,
`positionX` INTEGER NOT NULL DEFAULT 0,
`positionY` INTEGER NOT NULL DEFAULT 0,
`rotation` INTEGER NOT NULL DEFAULT 0,
`zoneId` INTEGER NOT NULL DEFAULT 1,
`characterTypeId` INTEGER NULL,
@ -105,8 +105,8 @@ CREATE TABLE `Object` (
`id` VARCHAR(191) NOT NULL,
`name` VARCHAR(191) NOT NULL,
`tags` JSON NULL,
`origin_x` DECIMAL(65, 30) NOT NULL DEFAULT 0,
`origin_y` DECIMAL(65, 30) NOT NULL DEFAULT 0,
`originX` DECIMAL(65, 30) NOT NULL DEFAULT 0,
`originY` DECIMAL(65, 30) NOT NULL DEFAULT 0,
`isAnimated` BOOLEAN NOT NULL DEFAULT false,
`frameSpeed` INTEGER NOT NULL DEFAULT 0,
`frameWidth` INTEGER NOT NULL DEFAULT 0,
@ -149,8 +149,8 @@ CREATE TABLE `ZoneObject` (
`zoneId` INTEGER NOT NULL,
`objectId` VARCHAR(191) NOT NULL,
`depth` INTEGER NOT NULL DEFAULT 0,
`position_x` INTEGER NOT NULL DEFAULT 0,
`position_y` INTEGER NOT NULL DEFAULT 0,
`positionX` INTEGER NOT NULL DEFAULT 0,
`positionY` INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
@ -160,21 +160,21 @@ CREATE TABLE `ZoneEventTile` (
`id` VARCHAR(191) NOT NULL,
`zoneId` INTEGER NOT NULL,
`type` ENUM('BLOCK', 'TELEPORT', 'NPC', 'ITEM') NOT NULL,
`position_x` INTEGER NOT NULL,
`position_y` INTEGER NOT NULL,
`teleportId` VARCHAR(191) NULL,
`positionX` INTEGER NOT NULL,
`positionY` INTEGER NOT 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,
`zoneEventTileId` VARCHAR(191) NOT NULL,
`toZoneId` INTEGER NOT NULL,
`toPosition_x` INTEGER NOT NULL,
`toPosition_y` INTEGER NOT NULL,
`toPositionX` INTEGER NOT NULL,
`toPositionY` INTEGER NOT NULL,
UNIQUE INDEX `ZoneEventTileTeleport_zoneEventTileId_key`(`zoneEventTileId`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
@ -215,7 +215,7 @@ ALTER TABLE `ZoneObject` ADD CONSTRAINT `ZoneObject_objectId_fkey` FOREIGN KEY (
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;
ALTER TABLE `ZoneEventTileTeleport` ADD CONSTRAINT `ZoneEventTileTeleport_zoneEventTileId_fkey` FOREIGN KEY (`zoneEventTileId`) REFERENCES `ZoneEventTile`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `ZoneEventTileTeleport` ADD CONSTRAINT `ZoneEventTileTeleport_toZoneId_fkey` FOREIGN KEY (`toZoneId`) REFERENCES `Zone`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -13,8 +13,8 @@ model SpriteAction {
sprite Sprite @relation(fields: [spriteId], references: [id], onDelete: Cascade)
action String
sprites Json?
origin_x Decimal @default(0)
origin_y Decimal @default(0)
originX Decimal @default(0)
originY Decimal @default(0)
isAnimated Boolean @default(false)
isLooping Boolean @default(false)
frameWidth Int @default(0)

View File

@ -40,8 +40,8 @@ model Character {
level Int @default(1)
experience Int @default(0)
role String @default("player")
position_x Int @default(0)
position_y Int @default(0)
positionX Int @default(0)
positionY Int @default(0)
rotation Int @default(0)
zoneId Int @default(1)
zone Zone @relation(fields: [zoneId], references: [id], onDelete: Cascade)

View File

@ -10,8 +10,8 @@ model Object {
id String @id @default(uuid())
name String
tags Json?
origin_x Decimal @default(0)
origin_y Decimal @default(0)
originX Decimal @default(0)
originY Decimal @default(0)
isAnimated Boolean @default(false)
frameSpeed Int @default(0)
frameWidth Int @default(0)
@ -48,14 +48,14 @@ model Zone {
}
model ZoneObject {
id String @id @default(uuid())
zoneId Int
zone Zone @relation(fields: [zoneId], references: [id], onDelete: Cascade)
objectId String
object Object @relation(fields: [objectId], references: [id], onDelete: Cascade)
depth Int @default(0)
position_x Int @default(0)
position_y Int @default(0)
id String @id @default(uuid())
zoneId Int
zone Zone @relation(fields: [zoneId], references: [id], onDelete: Cascade)
objectId String
object Object @relation(fields: [objectId], references: [id], onDelete: Cascade)
depth Int @default(0)
positionX Int @default(0)
positionY Int @default(0)
}
enum ZoneEventTileType {
@ -66,21 +66,21 @@ enum ZoneEventTileType {
}
model ZoneEventTile {
id String @id @default(uuid())
zoneId Int
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])
id String @id @default(uuid())
zoneId Int
zone Zone @relation(fields: [zoneId], references: [id], onDelete: Cascade)
type ZoneEventTileType
positionX Int
positionY Int
teleport ZoneEventTileTeleport?
}
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
id String @id @default(uuid())
zoneEventTileId String @unique
zoneEventTile ZoneEventTile @relation(fields: [zoneEventTileId], references: [id], onDelete: Cascade)
toZoneId Int
toZone Zone @relation(fields: [toZoneId], references: [id], onDelete: Cascade)
toPositionX Int
toPositionY Int
}