chore(cart): completed at (#8921)

This commit is contained in:
Carlos R. L. Rodrigues
2024-08-31 12:42:58 -03:00
committed by GitHub
parent 89c6ef8fc9
commit 4ffb49efd0
12 changed files with 148 additions and 4 deletions

View File

@@ -0,0 +1,15 @@
import { Migration } from "@mikro-orm/migrations"
export class Migration20240831125857 extends Migration {
async up(): Promise<void> {
this.addSql(
'alter table if exists "cart" add column if not exists "completed_at" timestamptz null;'
)
}
async down(): Promise<void> {
this.addSql(
'alter table if exists "cart" drop column if exists "completed_at";'
)
}
}

View File

@@ -147,6 +147,9 @@ export default class Cart {
})
shipping_methods = new Collection<Rel<ShippingMethod>>(this)
@Property({ columnType: "timestamptz", nullable: true })
completed_at: Date | null = null
@Property({
onCreate: () => new Date(),
columnType: "timestamptz",