Closed Bosek closed 6 days ago
@Bosek, thanks for highlighting. We are not handling casing on our custom modifiers, such as unique
. The ORM we use under the hood converts column names to a lowercase + underscored version and I believe we will need to do the same.
We'll get back with a solution asap.
Until then, you can use snake_cased column names, and it should work as expected.
Consider this snippet from model definition:
vatId: model.text().unique()
After calling
npx medusa db:generate
It will correctly change column name from vatId to vat_id(first row), but will not use it for setting up a unique key(second row). Error:
CREATE UNIQUE INDEX IF NOT EXISTS "IDX_economic_subject_vatId_unique" ON "economic_subject" (vatId) WHERE deleted_at IS NULL; - column "vatId" does not exist
System information
Medusa version: 1.20.6-preview-20240906120706 Node.js version: v21.2.0