From 632f2c97701e6ab3c2921a408b37794fe05bee1f Mon Sep 17 00:00:00 2001 From: Dennis Postma Date: Fri, 14 Mar 2025 00:25:06 +0100 Subject: [PATCH] New DB migration --- package-lock.json | 6 +++--- src/migrations/.snapshot-game.json | 10 ++++++++++ src/migrations/Migration20250312011946.ts | 13 ------------- ...20250221004940.ts => Migration20250313232305.ts} | 4 ++-- 4 files changed, 15 insertions(+), 18 deletions(-) delete mode 100644 src/migrations/Migration20250312011946.ts rename src/migrations/{Migration20250221004940.ts => Migration20250313232305.ts} (97%) diff --git a/package-lock.json b/package-lock.json index 403dcff..3a7121f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1949,9 +1949,9 @@ } }, "node_modules/bullmq": { - "version": "5.41.9", - "resolved": "https://registry.npmjs.org/bullmq/-/bullmq-5.41.9.tgz", - "integrity": "sha512-dcmBEo6CzLh3PQ7KN6qz5M8VsSv49vcXfEadgrUdfmUvYDpg630/yPV/Ov18unPT4IOCjz1XZSgpjs5DjwlBYw==", + "version": "5.43.0", + "resolved": "https://registry.npmjs.org/bullmq/-/bullmq-5.43.0.tgz", + "integrity": "sha512-gIl9b7yFNV6IE/5I/RsN8yrjkVJR/EC0tE580wF8jpWZukhY3YBJwIoUyMUYIIxeKRscc8DU5eIjuxqeQqfwAA==", "license": "MIT", "dependencies": { "cron-parser": "^4.9.0", diff --git a/src/migrations/.snapshot-game.json b/src/migrations/.snapshot-game.json index c9f81f2..2c67c86 100644 --- a/src/migrations/.snapshot-game.json +++ b/src/migrations/.snapshot-game.json @@ -492,6 +492,16 @@ "length": null, "mappedType": "json" }, + "pivot_points": { + "name": "pivot_points", + "type": "json", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": null, + "mappedType": "json" + }, "origin_x": { "name": "origin_x", "type": "numeric(10,2)", diff --git a/src/migrations/Migration20250312011946.ts b/src/migrations/Migration20250312011946.ts deleted file mode 100644 index 5d166a3..0000000 --- a/src/migrations/Migration20250312011946.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Migration } from '@mikro-orm/migrations'; - -export class Migration20250312011946 extends Migration { - - override async up(): Promise { - this.addSql(`alter table \`map_object\` change \`pivot_points\` \`depth_offsets\` json not null;`); - } - - override async down(): Promise { - this.addSql(`alter table \`map_object\` change \`depth_offsets\` \`pivot_points\` json not null;`); - } - -} diff --git a/src/migrations/Migration20250221004940.ts b/src/migrations/Migration20250313232305.ts similarity index 97% rename from src/migrations/Migration20250221004940.ts rename to src/migrations/Migration20250313232305.ts index 9b33416..09dc86b 100644 --- a/src/migrations/Migration20250221004940.ts +++ b/src/migrations/Migration20250313232305.ts @@ -1,6 +1,6 @@ import { Migration } from '@mikro-orm/migrations'; -export class Migration20250221004940 extends Migration { +export class Migration20250313232305 extends Migration { override async up(): Promise { this.addSql(`create table \`map\` (\`id\` varchar(255) not null, \`name\` varchar(255) not null default '', \`width\` int not null default 10, \`height\` int not null default 10, \`tiles\` json not null, \`pvp\` tinyint(1) not null default false, \`created_at\` datetime not null, \`updated_at\` datetime not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`); @@ -16,7 +16,7 @@ export class Migration20250221004940 extends Migration { this.addSql(`alter table \`map_event_tile_teleport\` add unique \`map_event_tile_teleport_map_event_tile_id_unique\`(\`map_event_tile_id\`);`); this.addSql(`alter table \`map_event_tile_teleport\` add index \`map_event_tile_teleport_to_map_id_index\`(\`to_map_id\`);`); - this.addSql(`create table \`map_object\` (\`id\` varchar(255) not null, \`name\` varchar(255) not null, \`tags\` json not null, \`pivot_points\` json not null, \`origin_x\` numeric(10,2) not null default 0, \`origin_y\` numeric(10,2) not null default 0, \`frame_rate\` int not null default 0, \`frame_width\` int not null default 0, \`frame_height\` int not null default 0, \`created_at\` datetime not null, \`updated_at\` datetime not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`); + this.addSql(`create table \`map_object\` (\`id\` varchar(255) not null, \`name\` varchar(255) not null, \`tags\` json not null, \`depth_offsets\` json not null, \`pivot_points\` json not null, \`origin_x\` numeric(10,2) not null default 0, \`origin_y\` numeric(10,2) not null default 0, \`frame_rate\` int not null default 0, \`frame_width\` int not null default 0, \`frame_height\` int not null default 0, \`created_at\` datetime not null, \`updated_at\` datetime not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`); this.addSql(`create table \`placed_map_object\` (\`id\` varchar(255) not null, \`map_id\` varchar(255) not null, \`map_object_id\` varchar(255) not null, \`is_rotated\` tinyint(1) not null default false, \`position_x\` int not null default 0, \`position_y\` int not null default 0, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`); this.addSql(`alter table \`placed_map_object\` add index \`placed_map_object_map_id_index\`(\`map_id\`);`);