Skip to content

Commit

Permalink
Update prisma monorepo to v3.2.0 (minor) (#6719)
Browse files Browse the repository at this point in the history
* Update prisma monorepo to v3.2.0

* update prisma clientVersion in tests

* update tests

* changeset

Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Charles <[email protected]>
  • Loading branch information
3 people authored Oct 6, 2021
1 parent fac96cb commit 704f68b
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 134 deletions.
7 changes: 7 additions & 0 deletions .changeset/smart-socks-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@keystone-next/keystone': patch
'@keystone-next/prisma-utils': patch
'@keystone-next/api-tests-legacy': patch
---

Upgraded Prisma monorepo packages to 3.2.0. See the release notes here https://github.com/prisma/prisma/releases/tag/3.2.0
8 changes: 4 additions & 4 deletions packages/keystone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
"@keystone-ui/toast": "^4.0.3",
"@keystone-ui/tooltip": "^4.0.2",
"@preconstruct/next": "^3.0.0",
"@prisma/client": "3.1.1",
"@prisma/migrate": "3.1.1",
"@prisma/sdk": "3.1.1",
"@prisma/client": "3.2.0",
"@prisma/migrate": "3.2.0",
"@prisma/sdk": "3.2.0",
"@sindresorhus/slugify": "^1.1.2",
"@types/apollo-upload-client": "14.1.0",
"@types/babel__core": "^7.1.16",
Expand Down Expand Up @@ -111,7 +111,7 @@
"pirates": "^4.0.1",
"pluralize": "^8.0.0",
"prettier": "^2.4.1",
"prisma": "3.1.1",
"prisma": "3.2.0",
"prompts": "^2.4.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
Expand Down
66 changes: 38 additions & 28 deletions packages/keystone/src/scripts/tests/migrations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ describe('useMigrations: false', () => {
await setupAndStopDevServerForMigrations(tmp);

expect(recording()).toMatchInlineSnapshot(`
"✨ Starting Keystone
⭐️ Dev Server Starting on http://localhost:3000
⭐️ GraphQL API Starting on http://localhost:3000/api/graphql
✨ Generating GraphQL and Prisma schemas
✨ The database is already in sync with the Prisma schema.
✨ Connecting to the database
✨ Creating server
✅ GraphQL API ready"
`);
"✨ Starting Keystone
⭐️ Dev Server Starting on http://localhost:3000
⭐️ GraphQL API Starting on http://localhost:3000/api/graphql
✨ Generating GraphQL and Prisma schemas
✨ The database is already in sync with the Prisma schema.
✨ Connecting to the database
✨ Creating server
✅ GraphQL API ready"
`);
});
test('warns when dropping field that has data in it', async () => {
const prevCwd = await setupInitialProjectWithoutMigrations();
Expand Down Expand Up @@ -153,20 +153,20 @@ describe('useMigrations: false', () => {
"
`);
expect(recording()).toMatchInlineSnapshot(`
"✨ Starting Keystone
⭐️ Dev Server Starting on http://localhost:3000
⭐️ GraphQL API Starting on http://localhost:3000/api/graphql
✨ Generating GraphQL and Prisma schemas
"✨ Starting Keystone
⭐️ Dev Server Starting on http://localhost:3000
⭐️ GraphQL API Starting on http://localhost:3000/api/graphql
✨ Generating GraphQL and Prisma schemas
⚠️ Warnings:
⚠️ Warnings:
• You are about to drop the column \`title\` on the \`Todo\` table, which still contains 1 non-null values.
Prompt: Do you want to continue? Some data will be lost. true
✨ Your database is now in sync with your schema. Done in 0ms
✨ Connecting to the database
✨ Creating server
✅ GraphQL API ready"
`);
• You are about to drop the column \`title\` on the \`Todo\` table, which still contains 1 non-null values.
Prompt: Do you want to continue? Some data will be lost. true
✨ Your database is now in sync with your schema. Done in 0ms
✨ Connecting to the database
✨ Creating server
✅ GraphQL API ready"
`);
});
test('exits when refusing data loss prompt', async () => {
const prevCwd = await setupInitialProjectWithoutMigrations();
Expand Down Expand Up @@ -264,15 +264,15 @@ model Todo {
`);

const { migration, migrationName } = await getGeneratedMigration(tmp, 1, 'init');

expect(migration).toEqual(`-- CreateTable
CREATE TABLE "Todo" (
"id" TEXT NOT NULL PRIMARY KEY,
"title" TEXT NOT NULL DEFAULT ''
);
`);

expect(recording().replace(migrationName, 'migration_name')).toEqual(`✨ Starting Keystone
expect(recording().replace(new RegExp(migrationName, 'g'), 'migration_name'))
.toEqual(`✨ Starting Keystone
⭐️ Dev Server Starting on http://localhost:3000
⭐️ GraphQL API Starting on http://localhost:3000/api/graphql
✨ Generating GraphQL and Prisma schemas
Expand All @@ -282,6 +282,7 @@ CREATE TABLE "Todo" (
Prompt: Name of migration init
✨ A migration has been created at migrations/migration_name
Prompt: Would you like to apply this migration? true
Applying migration \`migration_name\`
✅ The migration has been applied
✨ Connecting to the database
✨ Creating server
Expand Down Expand Up @@ -349,7 +350,8 @@ describe('useMigrations: true', () => {
"
`);

expect(recording().replace(migrationName, 'migration_name')).toMatchInlineSnapshot(`
expect(recording().replace(new RegExp(migrationName, 'g'), 'migration_name'))
.toMatchInlineSnapshot(`
"✨ Starting Keystone
⭐️ Dev Server Starting on http://localhost:3000
⭐️ GraphQL API Starting on http://localhost:3000/api/graphql
Expand All @@ -359,6 +361,7 @@ describe('useMigrations: true', () => {
Prompt: Name of migration add-is-complete
✨ A migration has been created at migrations/migration_name
Prompt: Would you like to apply this migration? true
Applying migration \`migration_name\`
✅ The migration has been applied
✨ Connecting to the database
✨ Creating server
Expand Down Expand Up @@ -423,7 +426,8 @@ describe('useMigrations: true', () => {
"
`);

expect(recording().replace(migrationName, 'migration_name')).toMatchInlineSnapshot(`
expect(recording().replace(new RegExp(migrationName, 'g'), 'migration_name'))
.toMatchInlineSnapshot(`
"✨ Starting Keystone
⭐️ Dev Server Starting on http://localhost:3000
⭐️ GraphQL API Starting on http://localhost:3000/api/graphql
Expand All @@ -437,6 +441,7 @@ describe('useMigrations: true', () => {
Prompt: Name of migration remove all fields except id
✨ A migration has been created at migrations/migration_name
Prompt: Would you like to apply this migration? true
Applying migration \`migration_name\`
✅ The migration has been applied
✨ Connecting to the database
✨ Creating server
Expand Down Expand Up @@ -484,7 +489,7 @@ describe('useMigrations: true', () => {

expect(
recording()
.replace(migrationName, 'migration_name')
.replace(new RegExp(migrationName, 'g'), 'migration_name')
.replace(oldMigrationName, 'old_migration_name')
).toMatchInlineSnapshot(`
"✨ Starting Keystone
Expand All @@ -511,6 +516,7 @@ describe('useMigrations: true', () => {
Prompt: Name of migration init
✨ A migration has been created at migrations/migration_name
Prompt: Would you like to apply this migration? true
Applying migration \`migration_name\`
✅ The migration has been applied
✨ Connecting to the database
✨ Creating server
Expand Down Expand Up @@ -652,12 +658,14 @@ describe('useMigrations: true', () => {

const { migrationName } = await getGeneratedMigration(tmp, 1, 'init');

expect(recording().replace(migrationName, 'migration_name')).toMatchInlineSnapshot(`
expect(recording().replace(new RegExp(migrationName, 'g'), 'migration_name'))
.toMatchInlineSnapshot(`
"✨ Starting Keystone
⭐️ Dev Server Starting on http://localhost:3000
⭐️ GraphQL API Starting on http://localhost:3000/api/graphql
✨ Generating GraphQL and Prisma schemas
✨ sqlite database \\"app.db\\" created at file:./app.db
Applying migration \`migration_name\`
✨ The following migration(s) have been applied:
migrations/
Expand Down Expand Up @@ -686,12 +694,14 @@ describe('useMigrations: true', () => {

const { migrationName } = await getGeneratedMigration(tmp, 1, 'init');

expect(recording().replace(migrationName, 'migration_name')).toMatchInlineSnapshot(`
expect(recording().replace(new RegExp(migrationName, 'g'), 'migration_name'))
.toMatchInlineSnapshot(`
"✨ Starting Keystone
⭐️ Dev Server Starting on http://localhost:3000
⭐️ GraphQL API Starting on http://localhost:3000/api/graphql
✨ Generating GraphQL and Prisma schemas
✨ Your database has been reset
Applying migration \`migration_name\`
✨ The following migration(s) have been applied:
migrations/
Expand Down
4 changes: 2 additions & 2 deletions prisma-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"private": true,
"main": "dist/prisma-utils.cjs.js",
"dependencies": {
"@prisma/generator-helper": "3.1.1",
"@prisma/sdk": "3.1.1",
"@prisma/generator-helper": "3.2.0",
"@prisma/sdk": "3.2.0",
"fs-extra": "^10.0.0",
"prettier": "^2.4.1"
},
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 @@ -135,7 +135,7 @@ export const expectPrismaError = (
args.map(({ path, message, code, target }) => ({
extensions: {
code: 'INTERNAL_SERVER_ERROR',
prisma: { clientVersion: '3.1.1', code, meta: { target } },
prisma: { clientVersion: '3.2.0', code, meta: { target } },
},
path,
message,
Expand Down
Loading

0 comments on commit 704f68b

Please sign in to comment.