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

chore: make referentialIntegrity preview feature GA #3428

Merged
merged 19 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,11 @@ impl TestApi {
}

pub fn datasource_block_string(&self) -> String {
let relation_mode =
if self.is_vitess() && self.preview_features().contains(PreviewFeature::ReferentialIntegrity) {
"\nrelationMode = \"prisma\""
} else {
""
};
let relation_mode = if self.is_vitess() {
"\nrelationMode = \"prisma\""
} else {
""
};

let namespaces: Vec<String> = self.namespaces().iter().map(|ns| format!(r#""{}""#, ns)).collect();

Expand All @@ -284,7 +283,7 @@ impl TestApi {
pub fn datasource_block(&self) -> DatasourceBlock<'_> {
self.args.datasource_block(
"env(TEST_DATABASE_URL)",
if self.is_vitess() && self.preview_features().contains(PreviewFeature::ReferentialIntegrity) {
if self.is_vitess() {
&[("relationMode", r#""prisma""#)]
} else {
&[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async fn a_table_without_uniques_should_ignore(api: &TestApi) -> TestResult {
Ok(())
}

#[test_connector(tags(Mysql))]
#[test_connector(tags(Mysql), exclude(Vitess))]
Copy link
Member

Choose a reason for hiding this comment

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

Why does this need to exclude Vitess now?

async fn remapping_field_names_to_empty_mysql(api: &TestApi) -> TestResult {
api.barrel()
.execute(|migration| {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use introspection_engine_tests::test_api::*;

#[test_connector(tags(Mysql))]
#[test_connector(tags(Mysql), exclude(Vitess))]
Copy link
Member

Choose a reason for hiding this comment

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

Why does this need to exclude Vitess now?

async fn an_enum_with_invalid_value_names_should_have_them_commented_out(api: &TestApi) -> TestResult {
let sql = r#"CREATE TABLE `test` ( `threechars` ENUM ('123', 'wow','$§!') );"#;
api.raw_cmd(sql).await;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async fn empty_preview_features_are_kept(api: &TestApi) -> TestResult {
Ok(())
}

#[test_connector(tags(Mysql), exclude(Vitess), preview_features("referentialIntegrity"))]
#[test_connector(tags(Mysql), exclude(Vitess))]
async fn relation_mode_parameter_is_not_added(api: &TestApi) -> TestResult {
let result = api.re_introspect("").await?;
assert!(!result.contains(r#"relationMode = "#));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ async fn referential_integrity_prisma(api: &TestApi) -> TestResult {

let input = indoc! {r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand All @@ -46,8 +45,7 @@ async fn referential_integrity_prisma(api: &TestApi) -> TestResult {

let expected = expect![[r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand Down Expand Up @@ -97,8 +95,7 @@ async fn referential_integrity_foreign_keys(api: &TestApi) -> TestResult {

let input = indoc! {r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand All @@ -121,8 +118,7 @@ async fn referential_integrity_foreign_keys(api: &TestApi) -> TestResult {

let expected = expect![[r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand Down Expand Up @@ -170,8 +166,7 @@ async fn relation_mode_prisma(api: &TestApi) -> TestResult {

let input = indoc! {r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand All @@ -194,8 +189,7 @@ async fn relation_mode_prisma(api: &TestApi) -> TestResult {

let expected = expect![[r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand Down Expand Up @@ -245,8 +239,7 @@ async fn relation_mode_foreign_keys(api: &TestApi) -> TestResult {

let input = indoc! {r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand All @@ -269,8 +262,7 @@ async fn relation_mode_foreign_keys(api: &TestApi) -> TestResult {

let expected = expect![[r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand Down Expand Up @@ -323,8 +315,7 @@ mod at_at_map {

let input = indoc! {r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand All @@ -351,8 +342,7 @@ mod at_at_map {

let expected = expect![[r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand Down Expand Up @@ -406,8 +396,7 @@ mod at_at_map {

let input = indoc! {r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand All @@ -434,8 +423,7 @@ mod at_at_map {

let expected = expect![[r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand Down Expand Up @@ -487,8 +475,7 @@ mod at_at_map {

let input = indoc! {r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand All @@ -515,8 +502,7 @@ mod at_at_map {

let expected = expect![[r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand Down Expand Up @@ -570,8 +556,7 @@ mod at_at_map {

let input = indoc! {r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand All @@ -598,8 +583,7 @@ mod at_at_map {

let expected = expect![[r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ async fn referential_integrity_prisma(api: &TestApi) -> TestResult {

let input = indoc! {r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand All @@ -48,8 +47,7 @@ async fn referential_integrity_prisma(api: &TestApi) -> TestResult {

let expected = expect![[r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand Down Expand Up @@ -101,8 +99,7 @@ async fn referential_integrity_foreign_keys(api: &TestApi) -> TestResult {

let input = indoc! {r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand All @@ -125,8 +122,7 @@ async fn referential_integrity_foreign_keys(api: &TestApi) -> TestResult {

let expected = expect![[r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand Down Expand Up @@ -176,8 +172,7 @@ async fn relation_mode_prisma(api: &TestApi) -> TestResult {

let input = indoc! {r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand All @@ -200,8 +195,7 @@ async fn relation_mode_prisma(api: &TestApi) -> TestResult {

let expected = expect![[r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand Down Expand Up @@ -253,8 +247,7 @@ async fn relation_mode_foreign_keys(api: &TestApi) -> TestResult {

let input = indoc! {r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand All @@ -277,8 +270,7 @@ async fn relation_mode_foreign_keys(api: &TestApi) -> TestResult {

let expected = expect![[r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand Down Expand Up @@ -333,8 +325,7 @@ mod at_at_map {

let input = indoc! {r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand All @@ -361,8 +352,7 @@ mod at_at_map {

let expected = expect![[r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand Down Expand Up @@ -418,8 +408,7 @@ mod at_at_map {

let input = indoc! {r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand All @@ -446,8 +435,7 @@ mod at_at_map {

let expected = expect![[r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand Down Expand Up @@ -501,8 +489,7 @@ mod at_at_map {

let input = indoc! {r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand All @@ -529,8 +516,7 @@ mod at_at_map {

let expected = expect![[r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand Down Expand Up @@ -586,8 +572,7 @@ mod at_at_map {

let input = indoc! {r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand All @@ -614,8 +599,7 @@ mod at_at_map {

let expected = expect![[r#"
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
provider = "prisma-client-js"
}

datasource db {
Expand Down