1
0
forked from noxious/server

CRUD for items

This commit is contained in:
2024-12-22 20:09:14 +01:00
parent 1facd2d641
commit dd9e039649
8 changed files with 220 additions and 2 deletions

View File

@ -55,6 +55,7 @@ CREATE TABLE `Item` (
`itemType` ENUM('WEAPON', 'HELMET', 'CHEST', 'LEGS', 'BOOTS', 'GLOVES', 'RING', 'NECKLACE') NOT NULL,
`stackable` BOOLEAN NOT NULL DEFAULT false,
`rarity` ENUM('COMMON', 'UNCOMMON', 'RARE', 'EPIC', 'LEGENDARY') NOT NULL DEFAULT 'COMMON',
`spriteId` VARCHAR(191) NULL,
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updatedAt` DATETIME(3) NOT NULL,
@ -256,6 +257,9 @@ ALTER TABLE `Chat` ADD CONSTRAINT `Chat_zoneId_fkey` FOREIGN KEY (`zoneId`) REFE
-- AddForeignKey
ALTER TABLE `SpriteAction` ADD CONSTRAINT `SpriteAction_spriteId_fkey` FOREIGN KEY (`spriteId`) REFERENCES `Sprite`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `Item` ADD CONSTRAINT `Item_spriteId_fkey` FOREIGN KEY (`spriteId`) REFERENCES `Sprite`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `PasswordResetToken` ADD CONSTRAINT `PasswordResetToken_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `User`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -1,3 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
# It should be added in your version-control system (e.g., Git)
provider = "mysql"

View File

@ -24,6 +24,7 @@ model Sprite {
spriteActions SpriteAction[]
characterTypes CharacterType[]
characterHairs CharacterHair[]
Item Item[]
}
model SpriteAction {
@ -38,7 +39,7 @@ model SpriteAction {
isLooping Boolean @default(false)
frameWidth Int @default(0)
frameHeight Int @default(0)
frameRate Int @default(0)
frameRate Int @default(0)
}
model Item {
@ -48,6 +49,8 @@ model Item {
itemType ItemType
stackable Boolean @default(false)
rarity ItemRarity @default(COMMON)
spriteId String?
sprite Sprite? @relation(fields: [spriteId], references: [id], onDelete: Cascade)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
characters CharacterItem[]