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

Add a Prisma adapter #3298

Merged
merged 1 commit into from
Sep 27, 2020
Merged

Add a Prisma adapter #3298

merged 1 commit into from
Sep 27, 2020

Conversation

timleslie
Copy link
Contributor

@timleslie timleslie commented Jul 27, 2020

Prisma 2 has recently been released. It provides a powerful javascript library for interfacing with databases. The Prisma team have recently received significant funding to continue development of their library.

This PR introduces support for using Prisma as a database adapter within Keystone.

We are still reviewing Prisma for feature completeness and correctness to ensure that all of Keystone's features will work as expected.

We are also investigating the Prisma migration framework in order to provide a better DX for developers who need to perform migrations on their database as their Keystone system evolves.

Note: This PR is still WIP, particularly in regard to how, where and when we are generating the Prisma client.

See also: prisma/prisma#3265

Feature Completeness

Relationships

Type Create Read Count Update Delete Notes
One-to-many one-sided
One-to-many two-sided prisma/prisma#3141
Many-to-many one-sided
Many-to-many two-sided
One-to-one ☑️
Self-referential
One-to-many one-sided
One-to-many two-sided prisma/prisma#3078
Many-to-many one-sided
Many-to-many two-sided
One-to-one ☑️ prisma/prisma#3153

Fields

Name Prisma Type Core Filter Required Unique Notes
Core
CalendarDay DateTime
Checkbox Boolean ☑️
DateTime DateTime + String
DateTimeUtc DateTime
Decimal N/A 🔴 🔴 🔴 🔴 Prisma does not currently support a decimal database type (prisma/prisma#3374) (prisma/prisma#3447)
File Json ? 🔴 ☑️ prisma/prisma#3579
Float Float
Integer Int
Password String ? ☑️ Need to be able to check for a regex
Relationship @relation ☑️ ☑️
Select Enum | Int | String
Slug String
Text String prisma/prisma-client-js#690
Url String prisma/prisma-client-js#690
Uuid String ? We have used a String here for now, but we should really work out how to get an actual uuid column
Virtual ☑️ ☑️ ☑️ ☑️ ☑️
Extra
Color String prisma/prisma-client-js#690
Content @relation ☑️ ☑️
AuthedRelationship @relation ☑️ ☑️
AutoIncrement Int
CloudinaryImage Json ? ? ? ☑️
GoogleLocation Json ? ? ☑️
Markdown String prisma/prisma-client-js#690
MongoId String
OEmbed Json ? ? ? ☑️
Unsplash Json ? ? ? ☑️
Wysiwyg String
  • ✅ - Working
  • 🔴 - Not working (test failures)
  • ☑️ - N/A (working by default)
  • ❓ - Still being investigated

@changeset-bot
Copy link

changeset-bot bot commented Jul 27, 2020

🦋 Changeset detected

Latest commit: 66c00bc

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@timleslie timleslie force-pushed the prisma-adapter branch 8 times, most recently from 6a0d655 to ad28984 Compare August 3, 2020 22:30
@timleslie timleslie force-pushed the prisma-adapter branch 3 times, most recently from d3f9e66 to 6196387 Compare August 11, 2020 01:58
@timleslie timleslie force-pushed the prisma-adapter branch 8 times, most recently from 580b53b to 2110bb5 Compare August 18, 2020 05:20
// JM: I wonder if performing a regex match here leaks any timing info that
// could be used to extract information about the hash.. :/
return {
// FIXME: Prisma needs to support regex matching...
Copy link
Member

@emmatown emmatown Sep 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a prisma issue about this? I tried searching on the prisma repo but couldn't find anything

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I know of, it's something I need to bring up with them, I just need to take the time to formulate the question properly so I can explain exactly what the feature would look like.

examples/todo/index.js Outdated Show resolved Hide resolved
@timleslie timleslie force-pushed the prisma-adapter branch 9 times, most recently from f86764d to 451078a Compare September 25, 2020 03:10
@timleslie timleslie changed the title [WIP] Add a Prisma adapter Add a Prisma adapter Sep 25, 2020
@timleslie timleslie merged commit f70c9f1 into master Sep 27, 2020
@timleslie timleslie deleted the prisma-adapter branch September 27, 2020 22:11
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

Successfully merging this pull request may close these issues.

5 participants