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

Use db.provider in example projects #5388

Merged
merged 1 commit into from
Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .changeset/orange-toes-develop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'@keystone-next/example-auth': patch
'@keystone-next/app-basic': patch
'@keystone-next/example-ecommerce': patch
'keystone-next-app': patch
'@keystone-next/example-next-lite': patch
'@keystone-next/example-roles': patch
'@keystone-next/example-sandbox': patch
'@keystone-next/example-todo': patch
---

Updated example project to use the new `db.provider` config option over the deprecated `db.adapter` option.
4 changes: 2 additions & 2 deletions examples-next/auth/keystone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ const { withAuth } = createAuth({
export default withAuth(
config({
db: process.env.DATABASE_URL
? { adapter: 'prisma_postgresql', url: process.env.DATABASE_URL }
: { adapter: 'prisma_sqlite', url: 'file:./keystone.db' },
? { provider: 'postgresql', url: process.env.DATABASE_URL }
: { provider: 'sqlite', url: 'file:./keystone.db' },
lists,
ui: {},
session: withItemData(
Expand Down
4 changes: 2 additions & 2 deletions examples-next/basic/keystone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const auth = createAuth({
export default auth.withAuth(
config({
db: process.env.DATABASE_URL
? { adapter: 'prisma_postgresql', url: process.env.DATABASE_URL }
: { adapter: 'prisma_sqlite', url: 'file:./keystone.db' },
? { provider: 'postgresql', url: process.env.DATABASE_URL }
: { provider: 'sqlite', url: 'file:./keystone.db' },
// NOTE -- this is not implemented, keystone currently always provides a graphql api at /api/graphql
// graphql: {
// path: '/api/graphql',
Expand Down
4 changes: 2 additions & 2 deletions examples-next/ecommerce/keystone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ export default withAuth(
},
},
db: process.env.DATABASE_URL
? { adapter: 'prisma_postgresql', url: process.env.DATABASE_URL }
? { provider: 'postgresql', url: process.env.DATABASE_URL }
: {
adapter: 'prisma_sqlite',
provider: 'sqlite',
url: databaseURL,
async onConnect(keystone) {
console.log('Connected to the database!');
Expand Down
2 changes: 1 addition & 1 deletion examples-next/graphql-api-endpoint/keystone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default auth.withAuth(
enableNextJsGraphqlApiEndpoint: true,
},
db: {
adapter: 'prisma_postgresql',
provider: 'postgresql',
url: process.env.DATABASE_URL || 'postgres://username:password@localhost/database-name',
},
ui: {
Expand Down
2 changes: 1 addition & 1 deletion examples-next/next-lite/keystone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { config } from '@keystone-next/keystone/schema';
import { Post } from './schema';

export default config({
db: { adapter: 'prisma_sqlite', url: 'file:./app.db' },
db: { provider: 'sqlite', url: 'file:./app.db' },
experimental: {
generateNextGraphqlAPI: true,
generateNodeAPI: true,
Expand Down
4 changes: 2 additions & 2 deletions examples-next/roles/keystone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ const { withAuth } = createAuth({
export default withAuth(
config({
db: process.env.DATABASE_URL
? { adapter: 'prisma_postgresql', url: process.env.DATABASE_URL }
: { adapter: 'prisma_sqlite', url: 'file:./keystone.db' },
? { provider: 'postgresql', url: process.env.DATABASE_URL }
: { provider: 'sqlite', url: 'file:./keystone.db' },
lists,
ui: {
/* Everyone who is signed in can access the Admin UI */
Expand Down
4 changes: 2 additions & 2 deletions examples-next/sandbox/keystone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { lists } from './schema';
export default config({
db: process.env.DATABASE_URL?.startsWith('postgres')
? {
adapter: 'prisma_postgresql',
provider: 'postgresql',
url: process.env.DATABASE_URL,
}
: {
adapter: 'prisma_sqlite',
provider: 'sqlite',
url: process.env.DATABASE_URL || 'file:./dev.db',
},
lists,
Expand Down
2 changes: 1 addition & 1 deletion examples-next/todo/keystone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const { withAuth } = createAuth({
export default withAuth(
config({
db: {
adapter: 'prisma_postgresql',
provider: 'postgresql',
url: process.env.DATABASE_URL || 'postgres://keystone5:k3yst0n3@localhost:5432/todo-example',
},
lists,
Expand Down