Skip to content

Commit

Permalink
reproduce prisma/prisma/20557 (prisma#4155)
Browse files Browse the repository at this point in the history
The issue shows up (the test fails) on cockroachdb 23.1 but not 22.2.

Also sets up cockroachdb 23.1 but does not add it to CI (that will be
done in prisma#4132).
  • Loading branch information
tomhoule authored Aug 22, 2023
1 parent 2804dc9 commit 9c82a05
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .test_database_urls/cockroachdb_23_1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export TEST_DATABASE_URL="postgresql://prisma@localhost:26260"

9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
version: "3"
services:
cockroach_23_1:
image: prismagraphql/cockroachdb-custom:23.1
command: |
start-single-node --insecure
ports:
- "26260:26257"
networks:
- databases

cockroach_22_2:
image: prismagraphql/cockroachdb-custom:22.2
restart: always
Expand Down
43 changes: 43 additions & 0 deletions schema-engine/sql-migration-tests/tests/migrations/cockroachdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1233,6 +1233,49 @@ fn bigint_defaults_work(api: TestApi) {
api.schema_push(schema).send().assert_green().assert_no_steps();
}

// regression test for https://github.com/prisma/prisma/issues/20557
#[test_connector(tags(CockroachDb))]
fn alter_type_works(api: TestApi) {
let schema = r#"
datasource db {
provider = "cockroachdb"
url = env("TEST_DATABASE_URL")
}
model test {
id Int @id
one BigInt
two BigInt
}
"#;
api.schema_push(schema).send().assert_green();
api.schema_push(schema).send().assert_green().assert_no_steps();

let to_schema = r#"
datasource db {
provider = "cockroachdb"
url = env("TEST_DATABASE_URL")
}
model test {
id Int @id
one Int
two Int
}
"#;

let migration = api.connector_diff(
DiffTarget::Datamodel(schema.into()),
DiffTarget::Datamodel(to_schema.into()),
None,
);

// panic!("{migration}");
api.raw_cmd(&migration);
}

#[test_connector(tags(CockroachDb))]
fn schema_from_introspection_docs_works(api: TestApi) {
let sql = r#"
Expand Down

0 comments on commit 9c82a05

Please sign in to comment.