Skip to content

teardown should attempt to delete dbName table#2083

Merged
cannikin merged 9 commits intoredwoodjs:mainfrom
nexneo:patch-1
Apr 19, 2021
Merged

teardown should attempt to delete dbName table#2083
cannikin merged 9 commits intoredwoodjs:mainfrom
nexneo:patch-1

Conversation

@nexneo
Copy link
Copy Markdown
Contributor

@nexneo nexneo commented Mar 24, 2021

model name can be different than dbName when @@map("actual_table_name") has been used in prisma schema

I'm unsure if there is any test associated with jest setup, please suggest if I need to do anything else here.
Thanks!

model name can be different than dbName when @@Map has been used in prisma schema
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 24, 2021

📦 PR Packages

Click to Show Package Download Links

https://rw-pr-redwoodjs-com.s3.amazonaws.com/2083/create-redwood-app-0.30.0-bcd1221.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2083/redwoodjs-api-0.30.0-bcd1221.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2083/redwoodjs-api-server-0.30.0-bcd1221.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2083/redwoodjs-auth-0.30.0-bcd1221.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2083/redwoodjs-cli-0.30.0-bcd1221.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2083/redwoodjs-core-0.30.0-bcd1221.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2083/redwoodjs-dev-server-0.30.0-bcd1221.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2083/redwoodjs-eslint-config-0.30.0-bcd1221.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2083/redwoodjs-eslint-plugin-redwood-0.30.0-bcd1221.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2083/redwoodjs-forms-0.30.0-bcd1221.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2083/redwoodjs-internal-0.30.0-bcd1221.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2083/redwoodjs-prerender-0.30.0-bcd1221.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2083/redwoodjs-router-0.30.0-bcd1221.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2083/redwoodjs-structure-0.30.0-bcd1221.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2083/redwoodjs-testing-0.30.0-bcd1221.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2083/redwoodjs-web-0.30.0-bcd1221.tgz

Install this PR by running yarn rw upgrade --pr 2083:0.30.0-bcd1221

@thedavidprice
Copy link
Copy Markdown
Contributor

Thanks for this @nexneo! We're heads down on QA for the v0.28 release. I'm adding this to the review queue as soon as we're post v0.28.

@thedavidprice thedavidprice requested a review from cannikin April 10, 2021 00:12
@thedavidprice
Copy link
Copy Markdown
Contributor

@cannikin I believe this one relates to the "teardown test DB" work you've been overseeing ongoing. Could you review and advise on failing tests? Thanks!

@cannikin
Copy link
Copy Markdown
Contributor

Hmm, how do you figure out what actually failed? All the messages seem to be cypress itself complaining that that there was a failure, but it doesn't bubble up and tell you what actually failed in the test suite?

image

@cannikin
Copy link
Copy Markdown
Contributor

I guess it's something inside api/src/services/posts/posts.test.js? That would be the one in the app, that's generated as a result of a generator somewhere, correct? Does that fail for you locally @nexneo ?

@nexneo
Copy link
Copy Markdown
Contributor Author

nexneo commented Apr 13, 2021

I guess it's something inside api/src/services/posts/posts.test.js? That would be the one in the app, that's generated as a result of a generator somewhere, correct? Does that fail for you locally @nexneo ?

Let me explain issue I was trying to solve here. In redwood blog example if you change schema.prisma Post model with @@map("posts") as follows - After that if you run api service tests then in tearDown tests will fail because in teardown code m.name is Post but database table is posts so in that case m.dbName should be used.

Also I figured out issue why tests were failing previously, when you do not override table name with @@map m.dbName is null. Now first it tries to use m.dbName and then m.name. With that change all tests are passing now

model Post {
  id       Int @id @default(autoincrement())
  title    String
  slug     String @unique
  author   String
  body     String
  image    String?
  tags     Tag[]
  postedAt DateTime?
  @@map("posts")
}

@cannikin Do you want me to do anything else here.

@nexneo
Copy link
Copy Markdown
Contributor Author

nexneo commented Apr 19, 2021

@cannikin @thedavidprice Can you please update status? Thanks

@cannikin
Copy link
Copy Markdown
Contributor

Looks good! I'll merge assuming all the tests pass after this rebase. Thanks!

@cannikin cannikin merged commit 36b6f91 into redwoodjs:main Apr 19, 2021
@thedavidprice thedavidprice added this to the next-release milestone Apr 20, 2021
@nexneo nexneo deleted the patch-1 branch April 20, 2021 04:00
dac09 added a commit to dac09/redwood that referenced this pull request Apr 21, 2021
…erve-web

* 'main' of github.com:redwoodjs/redwood: (40 commits)
  Support generating typescript cells and pages | Autodetect ts project (redwoodjs#2279)
  create-redwood-app messages: moved app start commands to end (redwoodjs#2278)
  Add import type to configuration files (redwoodjs#2214)
  Bump @reach/skip-nav from 0.13.2 to 0.15.0 (redwoodjs#2237)
  Adding Setup Deploy Render Command (redwoodjs#2099)
  Disable role linting in Routes (redwoodjs#2318)
  v0.30.1 (redwoodjs#2322)
  teardown should attempt to delete dbName table (redwoodjs#2083)
  Restore @storybook/addon-a11y (redwoodjs#2309)
  fix(auth): Implement automatic token refresh on supported providers (redwoodjs#2277)
  fix(cli): move api-server dep from api to cli (redwoodjs#2307)
  Static typing for cells (redwoodjs#2208)
  Recommended Babel package upgrades (dependabot) (redwoodjs#2255)
  v0.30.0 (redwoodjs#2301)
  upgrade Prisma v2.21.0 (redwoodjs#2273)
  Further improvements to CONTRIBUTING.md (redwoodjs#2261)
  Adds better messages for rwt link | Watcher does not exist on build failure | Only remove node_modules after a succesful framework build (redwoodjs#2269)
  Update named param types in router readme (redwoodjs#2262)
  Bump core-js from 3.6.5 to 3.10.1 (redwoodjs#2243)
  Fix: webpack optimizations for JS (redwoodjs#2235)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants