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

Can't setup dev sqlite database #7

Closed
arcontechnologies opened this issue Mar 25, 2020 · 1 comment
Closed

Can't setup dev sqlite database #7

arcontechnologies opened this issue Mar 25, 2020 · 1 comment
Assignees

Comments

@arcontechnologies
Copy link

Hi,

I do not know yarn and nodejs. So I installed both of them and modules were instralled by after. The issue I'm facing is when I'm running : yarn redwood db seed

it tells me :

PrismaClientUnknownRequestError:
Invalid db.country.create() invocation in
C:\Users\albel\Documents\covid19\api\prisma\seeds.js:64:22

   60 }
   61
   62 async function main() {
   63   await asyncForEach(countries, async (country) => {
→  64     await db.country.create(

Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some("no such table: C:.Country"))) })
    at PrismaClientFetcher.request (C:\Users\albel\Documents\covid19\node_modules\@prisma\client\index.js:90:17)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
Seeding your database... [completed]
Done in 1.86s.

the schema.prisma looks like this

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

generator photonjs {
  provider = "prisma-client-js"
  binaryTargets = ["native", "rhel-openssl-1.0.x"]
}

model Day {
  id Int @id @default(autoincrement())
  date DateTime @unique
  createdAt DateTime @default(now())
  counts DailyCount[]
}

model Country {
  id Int @id @default(autoincrement())
  iso String @unique
  worldometersSlug String @unique
  name String
  createdAt DateTime @default(now())
  dailyCounts DailyCount[]
}

model DailyCount {
  id Int @id @default(autoincrement())
  date Day
  country Country
  totalCases Int
  newCases Int
  currentlyInfected Int
  totalDeaths Int
  newDeaths Int
}

How can I add a new country ?

Any insight on what I doing wrong ?
thanks

@zachlatta
Copy link
Collaborator

Hey, if you're looking to get the app running locally, you need to edit the schema.prisma file to look like this at the top:

datasource DS {
  provider = "sqlite"
  url = env("DATABASE_URL")
}

To add a new country, Worldometers scraping is currently broken. Can you assist in #4?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants