-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cart): Migration file #6156
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Ignored Deployments
|
export class CartModuleSetup20240122122952 extends Migration { | ||
async up(): Promise<void> { | ||
this.addSql( | ||
'create table "cart_address" ("id" text not null, "customer_id" text null, "company" text null, "first_name" text null, "last_name" text null, "address_1" text null, "address_2" text null, "city" text null, "country_code" text null, "province" text null, "postal_code" text null, "phone" text null, "metadata" jsonb null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), constraint "cart_address_pkey" primary key ("id"));' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to add if not exists
everywhere. Creating tables, constraints and indexes.
That will avoid issues when modularizing things if you want to move it to another DB for example, where you copy all the data, but you might not have the migrations of that module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I just left a few suggestions, and a few optional indexes in case we have these entites publicly exposed and we want the hability to query them from the other module. eg: Tax -> CartLineItemsTaxLines
If we won't have them and will only expand CartLineItemsTaxLines -> Tax, it is alright.
columnType: "text", | ||
nullable: true, | ||
index: "IDX_cart_region_id", | ||
}) | ||
region_id?: string | null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
region_id?: string | null | |
region_id: string | null = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will clean up all cart data models with respect to our new convention in a separate PR. They haven't been updated since we decided to do = null
No description provided.