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

prisma2 lift save creates two new .db files for SQLite #936

Closed
nikolasburk opened this issue Nov 14, 2019 · 7 comments
Closed

prisma2 lift save creates two new .db files for SQLite #936

nikolasburk opened this issue Nov 14, 2019 · 7 comments
Assignees
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug.
Milestone

Comments

@nikolasburk
Copy link
Member

I have this Prisma schema in a new project:

generator photon {
  provider = "photonjs"
}

datasource db {
  provider = "sqlite"
  url      = "file:dev.db"
}

model User {
  id    String  @default(cuid()) @id
  email String  @unique
  name  String?
}

This is the file structure:

$ tree .
.
├── README.md
└── prisma
    └── schema.prisma

1 directory, 2 files

When I run prisma lift save from the project root dir, two .db files are being created, one in the project root dir, the other one inside the prisma dir:

$ tree .
.
├── README.md
├── dev.db
└── prisma
    ├── dev.db
    ├── migrations
    │   ├── 20191114112229-init
    │   │   ├── README.md
    │   │   ├── schema.prisma
    │   │   └── steps.json
    │   └── lift.lock
    └── schema.prisma

3 directories, 8 files

I'm on:

prisma2@2.0.0-preview016.2, binary version: b72fd0a786adc77ba6c61d0a9637ff0371e433b0
@tomhoule tomhoule self-assigned this Nov 14, 2019
@pantharshit00
Copy link
Contributor

I can also confirm this bug.

image

@pantharshit00 pantharshit00 added bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. labels Nov 14, 2019
@sdnts
Copy link
Contributor

sdnts commented Nov 18, 2019

I'm also seeing this for prisma2 init with Blank Project > SQLite > JavaScript > Demo Script.
One DB file is in the project root (0KB in size) and the other one is in the prisma directory.

Quite possibly the same issue.

@tomhoule
Copy link
Contributor

We reproduced the bug and found where it comes from, but there is no spec regarding on the right thing to do. Issue: prisma/specs#329

@frntmp
Copy link

frntmp commented Nov 26, 2019

I think we found a related issue:

When the url to the sqlite-db contains .., i.e. something like url: "file:../../<some_folder>/data.db", the process hangs after selecting Yes Create new Sqlite database <some_folder>/data.db.

Let me know if this is unrelated and I should create a separate issue.

@pantharshit00
Copy link
Contributor

Can you please check if there is any error thrown when tracing is on @frntmp

To enable tracing, run export DEBUG=* or run set DEBUG=* if you are on windows.

@pantharshit00
Copy link
Contributor

@frntmp looks like someone else also reported the same, I can confirm this bug.

It is being tracked here: prisma/migrate#219

@timsuchanek
Copy link
Contributor

Thanks for reporting! A fix is available on the latest prisma2 alpha.
You can try it out with npm i -g prisma2@alpha.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug.
Projects
None yet
Development

No branches or pull requests

7 participants