Skip to content

Postgresql Migration - UUID Strategy Problems #9

@jacobfrantz1

Description

@jacobfrantz1

The commented out portion for the uuid strategy in the migration file (step 1) fails due to having the not null constraint.
await queryRunner.query(`ALTER TABLE "stock_movement" ADD "stockLocationId" uuid NOT NULL`);
should be
await queryRunner.query(`ALTER TABLE "stock_movement" ADD "stockLocationId" uuid`);

And the vendureV2Migrations function fails due to "product_variant_price.channelId" having the type "character varying" instead of uuid.

The subquery (SELECT "defaultCurrencyCode" FROM "channel" WHERE "id" = "channelId") needs channel id cast to uuid like (SELECT "defaultCurrencyCode" FROM "channel" WHERE "id" = "channelId"::uuid) when UUIDStrategy is used.

I don't think channelId should really be "character varying", it should probably be a foreign key with the type "uuid", but that isn't relevant to getting the migration to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions