Bug description
Hey there 👋,
I came across this issue when populating my test databases when performing E2E tests:
I adapted the following code to make sure it works with the new prisma migrate:
From:
// Generate a unique schema identifier for this test context
schema = `test_${nanoid()}`;
// Generate the pg connection string for the test schema
databaseUrl = `postgres://postgres:prisma@localhost:5432/prisma?schema=${schema}`;
// Set the required environment variable to contain the connection string
// to our database test schema
process.env.POSTGRES_URL = databaseUrl;
// Run the migrations to ensure our schema has the required structure
execSync(`${prismaBinary} migrate up --create-db --experimental`, {
env: {
...process.env,
DATABASE_URL: databaseUrl,
},
});
To:
// Generate a unique schema identifier for this test context
schema = `test_${nanoid()}`;
// Generate the pg connection string for the test schema
databaseUrl = `postgres://postgres:prisma@localhost:5432/prisma?schema=${schema}`;
// Set the required environment variable to contain the connection string
// to our database test schema
process.env.POSTGRES_URL = databaseUrl;
// Run the migrations to ensure our schema has the required structure
execSync(`${prismaBinary} migrate deploy --preview-feature`, {
env: {
...process.env,
DATABASE_URL: databaseUrl,
},
});
So far, no issues if my schema.prisma file does not contain any ENUM.
However, when using migrate migrations with any ENUM type in the SQL, e.g like the following:
-- CreateEnum
CREATE TYPE "public"."Role" AS ENUM ('USER', 'ADMIN');
The migration is not applied to my current test schema as the schema name is set to "public".
Would it be possible to omit the schema name when creating a new migration?
Expected behaviour
Create migration without a specified schema name to deploy the enum type to the current/specified schema.
e.g:
-- CreateEnum
CREATE TYPE "Role" AS ENUM ('USER', 'ADMIN');
Environment & setup
- OS: Mac OS
- Database: PostgreSQL
- Node.js version: v12.18.4
- Prisma version:
@prisma/cli : 2.13.0
@prisma/client : 2.13.0
Current platform : darwin
Query Engine : query-engine 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/query-engine-darwin)
Migration Engine : migration-engine-cli 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine : introspection-core 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary : prisma-fmt 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/prisma-fmt-darwin)
Studio : 0.329.0
Bug description
Hey there 👋,
I came across this issue when populating my test databases when performing E2E tests:
I adapted the following code to make sure it works with the new
prisma migrate:From:
To:
So far, no issues if my
schema.prismafile does not contain anyENUM.However, when using migrate migrations with any
ENUMtype in the SQL, e.g like the following:The migration is not applied to my current test schema as the schema name is set to
"public".Would it be possible to omit the schema name when creating a new migration?
Expected behaviour
Create migration without a specified schema name to deploy the enum type to the current/specified schema.
e.g:
Environment & setup