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

Remove deprecated config.db.adapter option #6518

Merged
merged 1 commit into from
Sep 9, 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
5 changes: 5 additions & 0 deletions .changeset/gold-pillows-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/keystone': major
---

Removed the deprecated `config.db.adapter` option. Please use `config.db.provider` to indicate the database provider for your system.
2 changes: 1 addition & 1 deletion packages/keystone/src/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const makeVercelIncludeTheSQLiteDB = (
directoryOfFileToBeWritten: string,
config: KeystoneConfig
) => {
if (config.db.adapter === 'prisma_sqlite' || config.db.provider === 'sqlite') {
if (config.db.provider === 'sqlite') {
const sqliteDbAbsolutePath = path.resolve(cwd, config.db.url.replace('file:', ''));

return `import path from 'path';
Expand Down
4 changes: 2 additions & 2 deletions packages/keystone/src/lib/createSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { makeCreateContext } from './context/createContext';
import { initialiseLists } from './core/types-for-lists';

export function getDBProvider(db: KeystoneConfig['db']): DatabaseProvider {
if (db.adapter === 'prisma_postgresql' || db.provider === 'postgresql') {
if (db.provider === 'postgresql') {
return 'postgresql';
} else if (db.adapter === 'prisma_sqlite' || db.provider === 'sqlite') {
} else if (db.provider === 'sqlite') {
return 'sqlite';
} else {
throw new Error(
Expand Down
28 changes: 2 additions & 26 deletions packages/keystone/src/types/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,32 +57,8 @@ export type DatabaseConfig = {
useMigrations?: boolean;
enableLogging?: boolean;
idField?: IdFieldConfig;
} & (
| (
| {
/** @deprecated The `adapter` option is deprecated. Please use `{ provider: 'postgresql' }` */
adapter: 'prisma_postgresql';
provider?: undefined;
}
| {
/** @deprecated The `adapter` option is deprecated. Please use `{ provider: 'postgresql' }` */
adapter?: undefined;
provider: 'postgresql';
}
)
| (
| {
/** @deprecated The `adapter` option is deprecated. Please use `{ provider: 'sqlite' }` */
adapter: 'prisma_sqlite';
provider?: undefined;
}
| {
/** @deprecated The `adapter` option is deprecated. Please use `{ provider: 'sqlite' }` */
adapter?: undefined;
provider: 'sqlite';
}
)
);
provider: 'postgresql' | 'sqlite';
};

// config.ui

Expand Down
2 changes: 1 addition & 1 deletion tests/api-tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { KeystoneConfig, DatabaseProvider } from '@keystone-next/keystone/types'
// export it from `@keystone-next/keystone/testing`.
export const apiTestConfig = (
config: Omit<KeystoneConfig, 'db'> & {
db?: Omit<KeystoneConfig['db'], 'provider' | 'url' | 'adapter'>;
db?: Omit<KeystoneConfig['db'], 'provider' | 'url'>;
}
): KeystoneConfig => ({
...config,
Expand Down