oguimbal / pg-mem

An in memory postgres DB instance for your unit tests
MIT License
1.95k stars 94 forks source link

USING name::custom_type #327

Open mirkadev opened 1 year ago

mirkadev commented 1 year ago

Describe the bug

It doesn't understand assigning a custom type with USING

ALTER TABLE "qualification_rules" ALTER COLUMN "name" TYPE qualification_rules_name_enum USING name::qualification_rules_name_enum;

To Reproduce


CREATE TYPE "qualification_rules_name_enum" AS ENUM('1', '2', '3');

CREATE TABLE "qualification_rules" ("id" SERIAL NOT NULL, "column" character varying NOT NULL, "settings" jsonb DEFAULT '[]'::jsonb, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), "taxonomyId" integer);

ALTER TABLE "qualification_rules" ALTER COLUMN "column" TYPE qualification_rules_name_enum USING name::qualification_rules_name_enum;

pg-mem version

cat ./node_modules/pg-mem/package.json | grep version
  "version": "2.6.12",
  "description": "A memory version of postgres",
    "release-deno": "git add -A && git commit -m \"Build deno [autogenerated commit]\" && PACKAGE_VERSION=$(cat package.json | grep \\\"version\\\" | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') && git tag $PACKAGE_VERSION && git push --tags",