From 2786010f0daabe7d8e1f3a1b8413251defcf2121 Mon Sep 17 00:00:00 2001 From: morteza-mortezai Date: Sat, 20 Jun 2026 20:38:03 +0330 Subject: [PATCH] bg migrations --- database/migrations/.snapshot-dmenu.json | 310 ++++++++++++++++++ .../migrations/Migration20260620170106.ts | 14 + 2 files changed, 324 insertions(+) create mode 100644 database/migrations/Migration20260620170106.ts diff --git a/database/migrations/.snapshot-dmenu.json b/database/migrations/.snapshot-dmenu.json index 19242db..2002607 100644 --- a/database/migrations/.snapshot-dmenu.json +++ b/database/migrations/.snapshot-dmenu.json @@ -127,6 +127,99 @@ "foreignKeys": {}, "nativeEnums": {} }, + { + "columns": { + "id": { + "name": "id", + "type": "char(26)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 26, + "mappedType": "character" + }, + "created_at": { + "name": "created_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "default": "now()", + "mappedType": "datetime" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "default": "now()", + "mappedType": "datetime" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "length": 6, + "mappedType": "datetime" + }, + "url": { + "name": "url", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 255, + "mappedType": "string" + } + }, + "name": "backgrounds", + "schema": "public", + "indexes": [ + { + "keyName": "backgrounds_created_at_index", + "columnNames": [ + "created_at" + ], + "composite": false, + "constraint": false, + "primary": false, + "unique": false + }, + { + "keyName": "backgrounds_deleted_at_index", + "columnNames": [ + "deleted_at" + ], + "composite": false, + "constraint": false, + "primary": false, + "unique": false + }, + { + "keyName": "backgrounds_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": {}, + "nativeEnums": {} + }, { "columns": { "id": { @@ -931,6 +1024,46 @@ "nullable": true, "length": 6, "mappedType": "datetime" + }, + "bg_url": { + "name": "bg_url", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "length": 255, + "mappedType": "string" + }, + "bg_opacity": { + "name": "bg_opacity", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "length": 255, + "mappedType": "string" + }, + "bg_blur": { + "name": "bg_blur", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "length": 255, + "mappedType": "string" + }, + "bg_overlay": { + "name": "bg_overlay", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "length": 255, + "mappedType": "string" } }, "name": "restaurants", @@ -1113,6 +1246,16 @@ "length": 255, "mappedType": "string" }, + "card_owner": { + "name": "card_owner", + "type": "varchar(255)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "length": 255, + "mappedType": "string" + }, "enabled": { "name": "enabled", "type": "boolean", @@ -5428,6 +5571,173 @@ }, "nativeEnums": {} }, + { + "columns": { + "id": { + "name": "id", + "type": "char(26)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 26, + "mappedType": "character" + }, + "created_at": { + "name": "created_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "default": "now()", + "mappedType": "datetime" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 6, + "default": "now()", + "mappedType": "datetime" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamptz", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": true, + "length": 6, + "mappedType": "datetime" + }, + "user_id": { + "name": "user_id", + "type": "char(26)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 26, + "mappedType": "character" + }, + "restaurant_id": { + "name": "restaurant_id", + "type": "char(26)", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "length": 26, + "mappedType": "character" + }, + "order_count": { + "name": "order_count", + "type": "int", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "integer" + }, + "total_order_amount": { + "name": "total_order_amount", + "type": "int", + "unsigned": false, + "autoincrement": false, + "primary": false, + "nullable": false, + "mappedType": "integer" + } + }, + "name": "user_restuarant", + "schema": "public", + "indexes": [ + { + "keyName": "user_restuarant_created_at_index", + "columnNames": [ + "created_at" + ], + "composite": false, + "constraint": false, + "primary": false, + "unique": false + }, + { + "keyName": "user_restuarant_deleted_at_index", + "columnNames": [ + "deleted_at" + ], + "composite": false, + "constraint": false, + "primary": false, + "unique": false + }, + { + "keyName": "user_restuarant_restaurant_id_index", + "columnNames": [ + "restaurant_id" + ], + "composite": false, + "constraint": false, + "primary": false, + "unique": false + }, + { + "keyName": "user_restuarant_user_id_restaurant_id_unique", + "columnNames": [ + "user_id", + "restaurant_id" + ], + "composite": true, + "constraint": true, + "primary": false, + "unique": true + }, + { + "keyName": "user_restuarant_pkey", + "columnNames": [ + "id" + ], + "composite": false, + "constraint": true, + "primary": true, + "unique": true + } + ], + "checks": [], + "foreignKeys": { + "user_restuarant_user_id_foreign": { + "constraintName": "user_restuarant_user_id_foreign", + "columnNames": [ + "user_id" + ], + "localTableName": "public.user_restuarant", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.users", + "updateRule": "cascade" + }, + "user_restuarant_restaurant_id_foreign": { + "constraintName": "user_restuarant_restaurant_id_foreign", + "columnNames": [ + "restaurant_id" + ], + "localTableName": "public.user_restuarant", + "referencedColumnNames": [ + "id" + ], + "referencedTableName": "public.restaurants", + "updateRule": "cascade" + } + }, + "nativeEnums": {} + }, { "columns": { "id": { diff --git a/database/migrations/Migration20260620170106.ts b/database/migrations/Migration20260620170106.ts new file mode 100644 index 0000000..add90ef --- /dev/null +++ b/database/migrations/Migration20260620170106.ts @@ -0,0 +1,14 @@ +import { Migration } from '@mikro-orm/migrations'; + +export class Migration20260620170106 extends Migration { + + override async up(): Promise { + this.addSql(`create table "backgrounds" ("id" char(26) not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, "url" varchar(255) not null, constraint "backgrounds_pkey" primary key ("id"));`); + this.addSql(`create index "backgrounds_created_at_index" on "backgrounds" ("created_at");`); + this.addSql(`create index "backgrounds_deleted_at_index" on "backgrounds" ("deleted_at");`); + + this.addSql(`alter table "restaurants" add column "bg_url" varchar(255) null, add column "bg_opacity" varchar(255) null, add column "bg_blur" varchar(255) null, add column "bg_overlay" varchar(255) null;`); + + } + +}