Skip to content

Commit

Permalink
add SET foreign_key_checks = 0; to test expectations
Browse files Browse the repository at this point in the history
  • Loading branch information
janpio committed Dec 2, 2023
1 parent ad2df4c commit a8e620c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions schema-engine/sql-migration-tests/tests/migrations/mysql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ fn default_current_timestamp_precision_follows_column_precision(api: TestApi) {

let expected_migration = indoc!(
r#"
SET foreign_key_checks = 0;
-- CreateTable
CREATE TABLE `A` (
`id` INTEGER NOT NULL,
Expand Down Expand Up @@ -317,6 +319,8 @@ fn datetime_dbgenerated_defaults(api: TestApi) {

let expected_migration = indoc!(
r#"
SET foreign_key_checks = 0;
-- CreateTable
CREATE TABLE `A` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
Expand All @@ -340,6 +344,8 @@ fn mysql_apply_migrations_errors_gives_the_failed_sql(api: TestApi) {
let migrations_directory = api.create_migrations_directory();

let migration = r#"
SET foreign_key_checks = 0;
CREATE TABLE `Cat` ( id INTEGER PRIMARY KEY );
DROP TABLE `Emu`;
Expand Down Expand Up @@ -479,6 +485,8 @@ fn dropping_m2m_relation_from_datamodel_works() {
});

let expected = expect![[r#"
SET foreign_key_checks = 0;
-- DropForeignKey
ALTER TABLE `_puppyFriendships` DROP FOREIGN KEY `_puppyFriendships_A_fkey`;
Expand Down Expand Up @@ -551,6 +559,8 @@ fn alter_constraint_name(mut api: TestApi) {
let expected_script = if is_mysql_5_6 || is_mariadb {
expect![[
r#"
SET foreign_key_checks = 0;
-- DropForeignKey
ALTER TABLE `B` DROP FOREIGN KEY `B_aId_fkey`;
Expand All @@ -575,6 +585,8 @@ fn alter_constraint_name(mut api: TestApi) {
"#]]
} else {
expect![[r#"
SET foreign_key_checks = 0;
-- DropForeignKey
ALTER TABLE `B` DROP FOREIGN KEY `B_aId_fkey`;
Expand Down Expand Up @@ -613,6 +625,8 @@ fn bigint_defaults_work(api: TestApi) {
}
"#;
let sql = expect![[r#"
SET foreign_key_checks = 0;
-- CreateTable
CREATE TABLE `foo` (
`id` VARCHAR(191) NOT NULL,
Expand Down

0 comments on commit a8e620c

Please sign in to comment.