migration
This commit is contained in:
@@ -1045,7 +1045,7 @@
|
|||||||
"unsigned": false,
|
"unsigned": false,
|
||||||
"autoincrement": false,
|
"autoincrement": false,
|
||||||
"primary": false,
|
"primary": false,
|
||||||
"nullable": false,
|
"nullable": true,
|
||||||
"length": 255,
|
"length": 255,
|
||||||
"mappedType": "string"
|
"mappedType": "string"
|
||||||
},
|
},
|
||||||
@@ -1055,7 +1055,7 @@
|
|||||||
"unsigned": false,
|
"unsigned": false,
|
||||||
"autoincrement": false,
|
"autoincrement": false,
|
||||||
"primary": false,
|
"primary": false,
|
||||||
"nullable": false,
|
"nullable": true,
|
||||||
"length": 6,
|
"length": 6,
|
||||||
"mappedType": "datetime"
|
"mappedType": "datetime"
|
||||||
},
|
},
|
||||||
@@ -1065,7 +1065,7 @@
|
|||||||
"unsigned": false,
|
"unsigned": false,
|
||||||
"autoincrement": false,
|
"autoincrement": false,
|
||||||
"primary": false,
|
"primary": false,
|
||||||
"nullable": false,
|
"nullable": true,
|
||||||
"length": 6,
|
"length": 6,
|
||||||
"mappedType": "datetime"
|
"mappedType": "datetime"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import { Migration } from '@mikro-orm/migrations';
|
||||||
|
|
||||||
|
export class Migration20260106054151 extends Migration {
|
||||||
|
|
||||||
|
override async up(): Promise<void> {
|
||||||
|
this.addSql(`alter table "restaurants" alter column "subscription_id" type varchar(255) using ("subscription_id"::varchar(255));`);
|
||||||
|
this.addSql(`alter table "restaurants" alter column "subscription_id" drop not null;`);
|
||||||
|
this.addSql(`alter table "restaurants" alter column "subscription_end_date" type timestamptz using ("subscription_end_date"::timestamptz);`);
|
||||||
|
this.addSql(`alter table "restaurants" alter column "subscription_end_date" drop not null;`);
|
||||||
|
this.addSql(`alter table "restaurants" alter column "subscription_start_date" type timestamptz using ("subscription_start_date"::timestamptz);`);
|
||||||
|
this.addSql(`alter table "restaurants" alter column "subscription_start_date" drop not null;`);
|
||||||
|
}
|
||||||
|
|
||||||
|
override async down(): Promise<void> {
|
||||||
|
this.addSql(`alter table "restaurants" alter column "subscription_id" type varchar(255) using ("subscription_id"::varchar(255));`);
|
||||||
|
this.addSql(`alter table "restaurants" alter column "subscription_id" set not null;`);
|
||||||
|
this.addSql(`alter table "restaurants" alter column "subscription_end_date" type timestamptz using ("subscription_end_date"::timestamptz);`);
|
||||||
|
this.addSql(`alter table "restaurants" alter column "subscription_end_date" set not null;`);
|
||||||
|
this.addSql(`alter table "restaurants" alter column "subscription_start_date" type timestamptz using ("subscription_start_date"::timestamptz);`);
|
||||||
|
this.addSql(`alter table "restaurants" alter column "subscription_start_date" set not null;`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -100,13 +100,13 @@ export class Restaurant extends BaseEntity {
|
|||||||
@Enum(() => PlanEnum)
|
@Enum(() => PlanEnum)
|
||||||
plan: PlanEnum = PlanEnum.Base;
|
plan: PlanEnum = PlanEnum.Base;
|
||||||
|
|
||||||
@Property({unique: true})
|
@Property({unique: true,nullable: true})
|
||||||
subscriptionId!: string;
|
subscriptionId?: string;
|
||||||
|
|
||||||
@Property()
|
@Property({nullable: true})
|
||||||
subscriptionEndDate!: Date;
|
subscriptionEndDate?: Date;
|
||||||
|
|
||||||
@Property()
|
@Property({nullable: true})
|
||||||
subscriptionStartDate!: Date;
|
subscriptionStartDate?: Date;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user