Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI command "fresh" fails to execute when disableForeignKeys is set to false #3004

Closed
luksiv opened this issue Apr 12, 2022 · 0 comments
Closed

Comments

@luksiv
Copy link

luksiv commented Apr 12, 2022

Description

When trying to execute the command npx mikro-orm migration:fresh it fails and throws an error.

Stack trace

DriverException: set session_replication_role = 'replica'; - permission denied to set parameter "session_replication_role"
    at PostgreSqlExceptionConverter.convertException (my-project/node_modules/@mikro-orm/core/platforms/ExceptionConverter.js:8:16)
    at PostgreSqlExceptionConverter.convertException (my-project/node_modules/@mikro-orm/postgresql/PostgreSqlExceptionConverter.js:42:22)
    at PostgreSqlDriver.convertException (my-project/node_modules/@mikro-orm/core/drivers/DatabaseDriver.js:173:54)
    at my-project/node_modules/@mikro-orm/core/drivers/DatabaseDriver.js:177:24
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async SchemaGenerator.execute (my-project/node_modules/@mikro-orm/knex/schema/SchemaGenerator.js:350:13)
    at async SchemaGenerator.dropSchema (my-project/node_modules/@mikro-orm/knex/schema/SchemaGenerator.js:77:9)
    at async Function.handleFreshCommand (my-project/node_modules/@mikro-orm/cli/commands/MigrationCommandFactory.js:164:9)
    at async Function.handleMigrationCommand (my-project/node_modules/@mikro-orm/cli/commands/MigrationCommandFactory.js:110:17)

Configuration

const config: Options = {
  ...,
  migrations: {
    ...,
    disableForeignKeys: false,
  },
  schemaGenerator: {
    disableForeignKeys: false,
  },
  ...
};

To reproduce

Execute command npx mikro-orm migration:fresh with any schema using PostgreSQL and setting schemaGenerator.disableForeignKeys = true and/or migrations.disableForeignKeys = true.

Additional context

PostgreSQL

Versions

Dependancy Version
node 16.10.0
typescript 4.3.5
mikro-orm 5.1.2
your-driver pg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant