Data Source migration issues


I’m running into issues with Data Source in Netlify and locally. Here’s my schema file:

When I deploy the app to Netlify, I got the below error:

3:44:17 PM: $ /opt/build/repo/node_modules/.bin/prisma migrate up --experimental --create-db
3:44:33 PM: 🏋️‍  migrate up
3:44:33 PM: Datamodel that will initialize the db:
3:44:33 PM: 
3:44:33 PM: datasource DS {
3:44:33 PM:   provider = "sqlite"
3:44:33 PM:   url = "***"
3:44:33 PM: }
3:44:33 PM: generator client {
3:44:33 PM:   provider      = "prisma-client-js"
3:44:33 PM:   binaryTargets = env("BINARY_TARGET")
3:44:33 PM: }
3:44:33 PM: model Dashboard {
3:44:33 PM:   id          String  @id @default(cuid())
3:44:33 PM:   name        String
3:44:33 PM:   json        String
3:44:33 PM:   createdAt   DateTime @default(now())
3:44:33 PM:   updatedAt   DateTime @default(now())
3:44:33 PM: }
3:44:33 PM: Checking the datasource for potential data loss...
3:44:33 PM: Error: Failure during a migration command: The migration produced an invalid schema.
3:44:33 PM: Datamodel error in schema that could not be rendered. Error validating source `DS`: The URL for datasource `DS` must start with the protocol `sqlite://`.

Another issue I notice locally is when I run “yarn redwood db up” multiple times. The first time, it will succeed. In subsequent times, it gives me the below error:

All migrations are already applied
error Command failed with signal "SIGSEGV".
info Visit for documentation about this command.
Migrate database up... [failed]
→ Command failed with exit code 1: yarn prisma migrate up --experimental --create-db
Command failed with exit code 1: yarn prisma migrate up --experimental --create-db

Ah, you’ve stumbled into a current issue we spent most of last week debugging. Check out the instructions for fix in this comment.

Locally, you might need to also delete the current migrations/ directory and run the save and up CLI commands again.

I started seeing this after I upgraded to Node v14, which I then reverted back to v12. Any chance you are using Node v14?

1 Like

@thedavid thanks so much for the help. Both issues are resolved.

1 Like