Skip to content

Commit

Permalink
Remove experimental.prismaSqlite (#5283)
Browse files Browse the repository at this point in the history
  • Loading branch information
timleslie authored Apr 5, 2021
1 parent 9557870 commit 192393d
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 29 deletions.
13 changes: 13 additions & 0 deletions .changeset/lucky-carrots-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@keystone-next/keystone': minor
'@keystone-next/types': minor
'@keystone-next/website': patch
'@keystone-next/example-auth': patch
'@keystone-next/app-basic': patch
'@keystone-next/example-ecommerce': patch
'@keystone-next/example-roles': patch
'@keystone-next/example-sandbox': patch
'@keystone-next/test-utils-legacy': patch
---

The flag `{ experimental: { prismaSqlite: true } }` is no longer required to use the SQLite adapter.
6 changes: 0 additions & 6 deletions docs-next/pages/apis/config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@ export default config({

### prisma_sqlite

Support for SQLite with Prisma is still in preview.
To use this option you must also set `{ experimental: { prismaSqlite: true } }`.

Advanced configuration:

- `enableLogging` (default: `false`): Enable logging from the Prisma client.
Expand Down Expand Up @@ -265,7 +262,6 @@ import { config } from '@keystone-next/keystone/schema';
export default config({
experimental: {
enableNextJsGraphqlApiEndpoint: true,
prismaSqlite: true,
}
/* ... */
});
Expand All @@ -274,7 +270,5 @@ export default config({
Options:

- `enableNextJsGraphqlApiEndpoint`: (coming soon)
- `prismaSqlite`: Enables the use of SQLite with Prisma.
This flag is required when setting `{ db: { adapter: 'prisma_sqlite' } }`.

export default ({ children }) => <Markdown>{children}</Markdown>;
1 change: 0 additions & 1 deletion examples-next/auth/keystone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export default withAuth(
db: process.env.DATABASE_URL
? { adapter: 'prisma_postgresql', url: process.env.DATABASE_URL }
: { adapter: 'prisma_sqlite', url: 'file:./keystone.db' },
experimental: { prismaSqlite: true },
lists,
ui: {},
session: withItemData(
Expand Down
1 change: 0 additions & 1 deletion examples-next/basic/keystone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export default auth.withAuth(
db: process.env.DATABASE_URL
? { adapter: 'prisma_postgresql', url: process.env.DATABASE_URL }
: { adapter: 'prisma_sqlite', url: 'file:./keystone.db' },
experimental: { prismaSqlite: true },
// NOTE -- this is not implemented, keystone currently always provides a graphql api at /api/graphql
// graphql: {
// path: '/api/graphql',
Expand Down
1 change: 0 additions & 1 deletion examples-next/ecommerce/keystone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export default withAuth(
}
},
},
experimental: { prismaSqlite: true },
lists: createSchema({
// Schema items go in here
User,
Expand Down
1 change: 0 additions & 1 deletion examples-next/roles/keystone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export default withAuth(
db: process.env.DATABASE_URL
? { adapter: 'prisma_postgresql', url: process.env.DATABASE_URL }
: { adapter: 'prisma_sqlite', url: 'file:./keystone.db' },
experimental: { prismaSqlite: true },
lists,
ui: {
/* Everyone who is signed in can access the Admin UI */
Expand Down
1 change: 0 additions & 1 deletion examples-next/sandbox/keystone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ export default config({
adapter: 'prisma_sqlite',
url: process.env.DATABASE_URL || 'file:./dev.db',
},
experimental: { prismaSqlite: true },
lists,
});
5 changes: 0 additions & 5 deletions packages-next/keystone/src/lib/createKeystone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ export function createKeystone(config: KeystoneConfig, prismaClient?: any) {
provider: 'postgresql',
});
} else if (db.adapter === 'prisma_sqlite') {
if (!config.experimental?.prismaSqlite) {
throw new Error(
'SQLite support is still experimental. You must set { experimental: { prismaSqlite: true } } in your config to use this feature.'
);
}
adapter = new PrismaAdapter({
prismaClient,
...db,
Expand Down
2 changes: 0 additions & 2 deletions packages-next/types/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ export type KeystoneConfig = {
experimental?: {
/** Enables nextjs graphql api route mode */
enableNextJsGraphqlApiEndpoint?: boolean;
/** Enable Prisma+SQLite support */
prismaSqlite?: boolean;
};
};

Expand Down
17 changes: 6 additions & 11 deletions packages/test-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,12 @@ async function setupFromConfig({
adapterName: AdapterName;
config: TestKeystoneConfig;
}) {
let db: KeystoneConfig['db'];
if (adapterName === 'prisma_postgresql') {
const adapterArgs = await argGenerator[adapterName]();
db = { adapter: adapterName, ...adapterArgs };
} else if (adapterName === 'prisma_sqlite') {
const adapterArgs = await argGenerator[adapterName]();
db = { adapter: adapterName, ...adapterArgs };
_config = { ..._config, experimental: { prismaSqlite: true } };
}

const config = initConfig({ ..._config, db: db!, ui: { isDisabled: true } });
const adapterArgs = await argGenerator[adapterName]();
const config = initConfig({
..._config,
db: { adapter: adapterName, ...adapterArgs },
ui: { isDisabled: true },
});

const prismaClient = await (async () => {
const { keystone, graphQLSchema } = createSystem(config);
Expand Down

1 comment on commit 192393d

@vercel
Copy link

@vercel vercel bot commented on 192393d Apr 5, 2021

Choose a reason for hiding this comment

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

Please sign in to comment.