-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return of some of the old normalization for now
- Loading branch information
Julius de Bruijn
committed
Oct 20, 2022
1 parent
01a002e
commit 0e91004
Showing
4 changed files
with
131 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
introspection-engine/introspection-engine-tests/tests/remapping_database_names/mysql.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
use expect_test::expect; | ||
use indoc::indoc; | ||
use introspection_engine_tests::test_api::*; | ||
use test_macros::test_connector; | ||
|
||
#[test_connector(tags(Mysql))] | ||
async fn remapping_enum_names(api: &TestApi) -> TestResult { | ||
let setup = indoc! {r#" | ||
CREATE TABLE `123Book` ( | ||
id INT NOT NULL AUTO_INCREMENT, | ||
1color ENUM ('black') NULL, | ||
PRIMARY KEY (id) | ||
) | ||
"#}; | ||
|
||
api.raw_cmd(setup).await; | ||
|
||
let expectation = expect![[r#" | ||
generator client { | ||
provider = "prisma-client-js" | ||
} | ||
datasource db { | ||
provider = "mysql" | ||
url = "env(TEST_DATABASE_URL)" | ||
} | ||
model Book { | ||
id Int @id @default(autoincrement()) | ||
color Book_color? @map("1color") | ||
@@map("123Book") | ||
} | ||
enum Book_color { | ||
black | ||
@@map("123Book_1color") | ||
} | ||
"#]]; | ||
|
||
api.expect_datamodel(&expectation).await; | ||
|
||
Ok(()) | ||
} |
46 changes: 46 additions & 0 deletions
46
introspection-engine/introspection-engine-tests/tests/remapping_database_names/postgresql.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
use expect_test::expect; | ||
use indoc::indoc; | ||
use introspection_engine_tests::test_api::*; | ||
use test_macros::test_connector; | ||
|
||
#[test_connector(tags(Postgres), exclude(CockroachDb))] | ||
async fn remapping_enum_names(api: &TestApi) -> TestResult { | ||
let setup = indoc! {r#" | ||
CREATE TYPE "123color" AS ENUM ('black'); | ||
CREATE TABLE "123Book" ( | ||
id SERIAL PRIMARY KEY, | ||
"1color" "123color" NULL | ||
); | ||
"#}; | ||
|
||
api.raw_cmd(setup).await; | ||
|
||
let expectation = expect![[r#" | ||
generator client { | ||
provider = "prisma-client-js" | ||
} | ||
datasource db { | ||
provider = "postgresql" | ||
url = "env(TEST_DATABASE_URL)" | ||
} | ||
model Book { | ||
id Int @id @default(autoincrement()) | ||
color color? @map("1color") | ||
@@map("123Book") | ||
} | ||
enum color { | ||
black | ||
@@map("123color") | ||
} | ||
"#]]; | ||
|
||
api.expect_datamodel(&expectation).await; | ||
|
||
Ok(()) | ||
} |