medusajs / medusa

Building blocks for digital commerce
https://medusajs.com
MIT License
24.45k stars 2.4k forks source link

Foreign key deadlock with customer.billing_address_id #7063

Open gempain opened 4 months ago

gempain commented 4 months ago

Bug report

Describe the bug

Field billing_address_id in table customer is not referenced in the Customer model. Also, it has a foreign key FK_8abe81b9aac151ae60bf507ad15 on address.id which creates a dealock with foreign key FK_9c9614b2f9d01665800ea8dbff7 from address.customer_id which points to customer.id.

System information

Medusa version (including plugins): "@medusajs/medusa": "1.20.2",

Steps to reproduce the behavior

Expected behavior

Column billing_address_id should either be dropped, or referenced in the Customer model.

Screenshots

Code snippets

Additional context

olivermrbl commented 4 months ago

We could remove the billing_address_id from the customer table and introduce a flag on the address to indicate whether or not it is the customer's default billing address. This has been done for the customer model in version 2.0.

For 1.*, this requires a few changes. We likely won't fix it in the near term. If this is proving to be a huge pain for you, you are more than welcome to send a PR for it.

gempain commented 4 months ago

Not a pain for me, just wanted to raise the point. Wait, there's a 2.0 coming out ? When's that happening ?

gempain commented 4 months ago

Aw, okay found this. Btw @olivermrbl I PMed you on X ;)

olivermrbl commented 4 months ago

Aw, okay found this. Btw @olivermrbl I PMed you on X ;)

Must have missed this, will check it!

olivermrbl commented 4 months ago

Wait, there's a 2.0 coming out ? When's that happening ?

Release candidate is expected in ~1 month.

gempain commented 4 months ago

Wait, there's a 2.0 coming out ? When's that happening ?

Release candidate is expected in ~1 month.

Can't wait !

olivermrbl commented 4 months ago

Given our upcoming 2.0 release, I will label this as a wont-fix. I'll gladly reopen the issue if something is experiencing issues with this.