DB adjustments
This commit is contained in:
parent
be2d7ca7f8
commit
fe437aa331
@ -0,0 +1,20 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `isEnemy` on the `Sprite` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `isPlayableCharacter` on the `Sprite` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `type` on the `Sprite` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE `Object` ADD COLUMN `frameHeight` INTEGER NOT NULL DEFAULT 0,
|
||||
ADD COLUMN `frameSpeed` INTEGER NOT NULL DEFAULT 0,
|
||||
ADD COLUMN `frameWidth` INTEGER NOT NULL DEFAULT 0,
|
||||
ADD COLUMN `isAnimated` BOOLEAN NOT NULL DEFAULT false;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Sprite` DROP COLUMN `isEnemy`,
|
||||
DROP COLUMN `isPlayableCharacter`,
|
||||
DROP COLUMN `type`,
|
||||
ADD COLUMN `frameHeight` INTEGER NOT NULL DEFAULT 0,
|
||||
ADD COLUMN `frameWidth` INTEGER NOT NULL DEFAULT 0;
|
@ -6,7 +6,7 @@
|
||||
// 3. Generate Prisma Client and type-safe models based on schema
|
||||
// npx prisma generate
|
||||
// 4. Create a new migration
|
||||
// npx prisma migrate dev --name init
|
||||
// npx prisma migrate dev --name [migration-name]
|
||||
// 5. Apply the migration
|
||||
// npx prisma migrate deploy
|
||||
|
||||
@ -20,18 +20,17 @@ datasource db {
|
||||
}
|
||||
|
||||
model Sprite {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
origin_x Decimal @default(0)
|
||||
origin_y Decimal @default(0)
|
||||
type String
|
||||
frameSpeed Int @default(0)
|
||||
isAnimated Boolean @default(false)
|
||||
isLooping Boolean @default(false)
|
||||
isPlayableCharacter Boolean @default(false)
|
||||
isEnemy Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
origin_x Decimal @default(0)
|
||||
origin_y Decimal @default(0)
|
||||
frameSpeed Int @default(0)
|
||||
frameWidth Int @default(0)
|
||||
frameHeight Int @default(0)
|
||||
isAnimated Boolean @default(false)
|
||||
isLooping Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model Tile {
|
||||
@ -43,14 +42,18 @@ model Tile {
|
||||
}
|
||||
|
||||
model Object {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
tags Json?
|
||||
origin_x Decimal @default(0)
|
||||
origin_y Decimal @default(0)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
ZoneObject ZoneObject[]
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
tags Json?
|
||||
origin_x Decimal @default(0)
|
||||
origin_y Decimal @default(0)
|
||||
isAnimated Boolean @default(false)
|
||||
frameSpeed Int @default(0)
|
||||
frameWidth Int @default(0)
|
||||
frameHeight Int @default(0)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
ZoneObject ZoneObject[]
|
||||
}
|
||||
|
||||
model Item {
|
||||
|
@ -12,25 +12,23 @@ class SpriteRepository {
|
||||
return prisma.sprite.findMany();
|
||||
}
|
||||
|
||||
async create(name: string, origin_x: number, origin_y: number, type: string): Promise<Sprite> {
|
||||
async create(name: string, origin_x: number, origin_y: number): Promise<Sprite> {
|
||||
return prisma.sprite.create({
|
||||
data: {
|
||||
name,
|
||||
origin_x,
|
||||
origin_y,
|
||||
type
|
||||
origin_y
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async update(id: string, name: string, origin_x: number, origin_y: number, type: string): Promise<Sprite> {
|
||||
async update(id: string, name: string, origin_x: number, origin_y: number): Promise<Sprite> {
|
||||
return prisma.sprite.update({
|
||||
where: { id },
|
||||
data: {
|
||||
name,
|
||||
origin_x,
|
||||
origin_y,
|
||||
type
|
||||
origin_y
|
||||
},
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user