-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
[Edit by @janpio] Most recent update, see this comment: #17558 (comment)
As mentioned in another issue: Following the Tutorial to baseline a database when using prisma in a new project with an existing database leads to an error:
The final step npx prisma migrate resolve --applied 0_init leads to the following error:
Error: P3017
The migration 0_init could not be found. Please make sure that the migration exists, and that you included the whole name of >the directory. (example: "20201207184859_initial_migration")
The database (in my case) is mssql - if it makes any difference.
The steps before (pulling, generating, creating migrations-directory and creating diff-sql) are all successful.
I tried the following things:
- Putting folder in quotes:
npx prisma migrate resolve --applied "0_init" - Passing the complete path:
npx prisma migrate resolve --applied ./prisma/migrations/0_init - Passing the complete path with filename:
npx prisma migrate resolve --applied ./prisma/migrations/0_init/migration.sql - Changing into prisma-directory and executing command
- Changing into prisma/migrations-directory and executing command
- Renaming folder "0_init" to "20201207184859_initial_migration" (I know, it's stupid) and running
npx prisma migrate resolve --applied 20201207184859_initial_migration
… to no avail.
For reference: Here is the relevant comment from the other issue:
Hi I'm facing the same issue as @mrunalhajare. Here is what I'm doing:
1. `npx prisma db pull` -- Populates schema.prisma correctly
2. `npx prisma generate` -- Success generating
3. `mkdir -p prisma/migrations/init`
4. `npx prisma migrate diff --from-empty --to-schema-datamodel prisma/schema.prisma --script > prisma/migrations/init/migration.sql` -- Creates migration.sql file in prisma/migrations/init directory
5. `npx prisma migrate resolve --applied init` -- ERROR
> Error: P3017
>
> The migration init could not be found. Please make sure that the migration exists, and that you included the whole name of the directory. (example: "20201207184859_initial_migration")
NOTE: I did manually create `migration_lock.toml` before step 5 above, but I get the same error.
Anything I'm doing wrong?
Originally posted by @simplypress in #11555 (comment)