forked from noxious/server
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
|
// 3. Generate Prisma Client and type-safe models based on schema
|
||||||
// npx prisma generate
|
// npx prisma generate
|
||||||
// 4. Create a new migration
|
// 4. Create a new migration
|
||||||
// npx prisma migrate dev --name init
|
// npx prisma migrate dev --name [migration-name]
|
||||||
// 5. Apply the migration
|
// 5. Apply the migration
|
||||||
// npx prisma migrate deploy
|
// npx prisma migrate deploy
|
||||||
|
|
||||||
@ -24,12 +24,11 @@ model Sprite {
|
|||||||
name String
|
name String
|
||||||
origin_x Decimal @default(0)
|
origin_x Decimal @default(0)
|
||||||
origin_y Decimal @default(0)
|
origin_y Decimal @default(0)
|
||||||
type String
|
|
||||||
frameSpeed Int @default(0)
|
frameSpeed Int @default(0)
|
||||||
|
frameWidth Int @default(0)
|
||||||
|
frameHeight Int @default(0)
|
||||||
isAnimated Boolean @default(false)
|
isAnimated Boolean @default(false)
|
||||||
isLooping Boolean @default(false)
|
isLooping Boolean @default(false)
|
||||||
isPlayableCharacter Boolean @default(false)
|
|
||||||
isEnemy Boolean @default(false)
|
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
}
|
}
|
||||||
@ -48,6 +47,10 @@ model Object {
|
|||||||
tags Json?
|
tags Json?
|
||||||
origin_x Decimal @default(0)
|
origin_x Decimal @default(0)
|
||||||
origin_y 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())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
ZoneObject ZoneObject[]
|
ZoneObject ZoneObject[]
|
||||||
|
@ -12,25 +12,23 @@ class SpriteRepository {
|
|||||||
return prisma.sprite.findMany();
|
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({
|
return prisma.sprite.create({
|
||||||
data: {
|
data: {
|
||||||
name,
|
name,
|
||||||
origin_x,
|
origin_x,
|
||||||
origin_y,
|
origin_y
|
||||||
type
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
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({
|
return prisma.sprite.update({
|
||||||
where: { id },
|
where: { id },
|
||||||
data: {
|
data: {
|
||||||
name,
|
name,
|
||||||
origin_x,
|
origin_x,
|
||||||
origin_y,
|
origin_y
|
||||||
type
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user