From d01a83d37801ad5efe19531c0f79419751207eb1 Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Sat, 2 Dec 2023 10:35:25 +0000 Subject: [PATCH] more updates of expectations --- libs/sql-ddl/src/mysql.rs | 2 ++ .../tests/create_migration/create_migration_tests.rs | 10 ++++++++++ .../sql-migration-tests/tests/migrations/mysql.rs | 6 +++--- .../tests/describers/mysql_describer_tests.rs | 2 ++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/libs/sql-ddl/src/mysql.rs b/libs/sql-ddl/src/mysql.rs index 4e745045103c..0ce76a619971 100644 --- a/libs/sql-ddl/src/mysql.rs +++ b/libs/sql-ddl/src/mysql.rs @@ -428,6 +428,8 @@ mod tests { let expected = indoc!( r#" + SET foreign_key_checks = 0; + CREATE TABLE `Cat` ( `id` INTEGER NULL AUTO_INCREMENT PRIMARY KEY, `test` BINARY(16) NOT NULL DEFAULT (uuid_to_bin(uuid())) diff --git a/schema-engine/sql-migration-tests/tests/create_migration/create_migration_tests.rs b/schema-engine/sql-migration-tests/tests/create_migration/create_migration_tests.rs index 50a167c699d3..defc16dd08e4 100644 --- a/schema-engine/sql-migration-tests/tests/create_migration/create_migration_tests.rs +++ b/schema-engine/sql-migration-tests/tests/create_migration/create_migration_tests.rs @@ -46,6 +46,8 @@ fn basic_create_migration_works(api: TestApi) { "#]] } else if is_mysql { expect![[r#" + SET foreign_key_checks = 0; + -- CreateTable CREATE TABLE `Cat` ( `id` INTEGER NOT NULL, @@ -158,6 +160,8 @@ fn creating_a_second_migration_should_have_the_previous_sql_schema_as_baseline(a "#]] } else if is_mysql { expect![[r#" + SET foreign_key_checks = 0; + -- CreateTable CREATE TABLE `Dog` ( `id` INTEGER NOT NULL, @@ -382,6 +386,8 @@ fn create_enum_step_only_rendered_when_needed(api: TestApi) { } else if is_mysql { indoc! { r#" + SET foreign_key_checks = 0; + -- CreateTable CREATE TABLE `Cat` ( `id` INTEGER NOT NULL, @@ -696,6 +702,8 @@ fn create_constraint_name_tests_w_implicit_names(api: TestApi) { } else if is_mysql { expect![[ r#" + SET foreign_key_checks = 0; + -- CreateTable CREATE TABLE `A` ( `id` INTEGER NOT NULL, @@ -933,6 +941,8 @@ fn create_constraint_name_tests_w_explicit_names(api: TestApi) { } else if is_mysql { expect![[ r#" + SET foreign_key_checks = 0; + -- CreateTable CREATE TABLE `A` ( `id` INTEGER NOT NULL, diff --git a/schema-engine/sql-migration-tests/tests/migrations/mysql.rs b/schema-engine/sql-migration-tests/tests/migrations/mysql.rs index 28ee30ca8e1b..66c6e5f68557 100644 --- a/schema-engine/sql-migration-tests/tests/migrations/mysql.rs +++ b/schema-engine/sql-migration-tests/tests/migrations/mysql.rs @@ -384,7 +384,7 @@ fn mysql_apply_migrations_errors_gives_the_failed_sql(api: TestApi) { Database error: target: test.0.primary: vttablet: rpc error: code = InvalidArgument desc = Unknown table 'vt_test_0.Emu' (errno 1051) (sqlstate 42S02) (CallerID: userData1): Sql: "drop table Emu", BindVars: {} - Please check the query number 2 from the migration file. + Please check the query number 3 from the migration file. "#]] } else if cfg!(windows) { @@ -398,7 +398,7 @@ fn mysql_apply_migrations_errors_gives_the_failed_sql(api: TestApi) { Database error: Unknown table 'mysql_apply_migrations_errors_gives_the_failed_sql.emu' - Please check the query number 2 from the migration file. + Please check the query number 3 from the migration file. "#]] } else { @@ -412,7 +412,7 @@ fn mysql_apply_migrations_errors_gives_the_failed_sql(api: TestApi) { Database error: Unknown table 'mysql_apply_migrations_errors_gives_the_failed_sql.Emu' - Please check the query number 2 from the migration file. + Please check the query number 3 from the migration file. "#]] }; diff --git a/schema-engine/sql-schema-describer/tests/describers/mysql_describer_tests.rs b/schema-engine/sql-schema-describer/tests/describers/mysql_describer_tests.rs index f0ce2833988e..af608a14f69b 100644 --- a/schema-engine/sql-schema-describer/tests/describers/mysql_describer_tests.rs +++ b/schema-engine/sql-schema-describer/tests/describers/mysql_describer_tests.rs @@ -2581,6 +2581,8 @@ fn mysql_foreign_key_on_delete_must_be_handled(api: TestApi) { #[test_connector(tags(Mysql))] fn mysql_join_table_unique_indexes_must_be_inferred(api: TestApi) { let sql = r#" + SET foreign_key_checks = 0; + CREATE TABLE `Cat` ( id INTEGER AUTO_INCREMENT PRIMARY KEY, name TEXT