question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

2.12 > 2.14 migration issue using `migrate dev` with Heroku database

See original GitHub issue

Updated to v2.14 and i can’t do migration. So I’ve deleted the migration folder and only have the schema. Then i run yarn prisma generate and i get

✔ Generated Prisma Client (2.14.0) to ./node_modules/@prisma/client in 279ms
You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client

import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()

warn Prisma 2.12.0 has breaking changes.
You can update your code with
`npx @prisma/codemods update-2.12 ./`
Read more at https://pris.ly/2.12

Why does it say still 2.12?

So then i tried prisma migrate dev --preview-feature and i get:

Error: A migration failed when applied to the shadow database:

P3014
Prisma Migrate could not create the shadow database. Please make sure the database user has permission to create databases.  More info: https://pris.ly/d/migrate-shadow. Original error: 
Database error: Error querying the database: db error: ERROR: permission denied to create database
   0: sql_migration_connector::flavour::postgres::sql_schema_from_migration_history
             at migration-engine/connectors/sql-migration-connector/src/flavour/postgres.rs:174
   1: sql_migration_connector::sql_database_migration_inferrer::calculate_drift
             at migration-engine/connectors/sql-migration-connector/src/sql_database_migration_inferrer.rs:59
   2: migration_core::api::DiagnoseMigrationHistory
             at migration-engine/core/src/api.rs:109
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

My db is hosted on heroku, i know 2.13 had this issue and 2.12 did not but i thought 2.14 fixed them?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
net-castercommented, Jan 6, 2021

I think your DB user needs (root) permissions to create/destroy databases.

P.S. It shows the current Prisma version in the first line Generated Prisma Client (2.14.0) to…, so you have upgraded successfully.

0reactions
Jolg42commented, Jan 7, 2021

So if you want to use an Heroku remote database with migrate dev you can track this issue that we plan to tackle for 2.15.0 https://github.com/prisma/prisma/issues/4751 😃

Thanks for reporting!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrating an Application to Another Region | Heroku Dev Center
Use the heroku-fork utility to migrate an existing application to another region.
Read more >
Migrating Heroku Postgres Databases to Private Spaces
Migration guide for moving a currently active Heroku Postgres database into a Heroku Private Space.
Read more >
Migrating from MySQL to Postgres on Heroku
Migrate to Heroku Postgres. Most applications that use an ORM library to access their database can easily switch to a PostgreSQL database.
Read more >
Importing and Exporting Heroku Postgres Databases
An alternative to using the dump and restore method of import/export if you have a Postgres instance on your local machine is to...
Read more >
Heroku Postgres
The Heroku Postgres add-on is a production database service, ... Using the CLI; Connecting to Heroku Postgres; Migrating between Plans ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found