From 50537758c5bb89f8fa902054930d282fd32c108b Mon Sep 17 00:00:00 2001 From: Matchu Date: Sat, 19 Sep 2020 04:01:29 -0700 Subject: [PATCH] start test/dev db IDs at 1, not wherever prod is We download the schema from prod, and omit real data, but I didn't notice that we were still pulling the metadata of the auto increment counter for IDs! Now, we scrub that from the schema file we save. --- package.json | 2 +- scripts/setup-mysql-dev-constants.sql | 2 +- scripts/setup-mysql-dev-schema.sql | 12 ++++++------ .../query-tests/__snapshots__/Pet.test.js.snap | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index a6144d8..02c8668 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "mysql-dev": "mysql --host=localhost --user=impress_2020_dev --password=impress_2020_dev --database=impress_2020_dev", "mysql-admin": "mysql --host=impress.openneo.net --user=matchu --password --database=openneo_impress", "mysqldump": "mysqldump --host=impress.openneo.net --user=$(dotenv -p IMPRESS_MYSQL_USER) --password=$(dotenv -p IMPRESS_MYSQL_PASSWORD) --column-statistics=0", - "download-mysql-schema": "yarn --silent mysqldump --no-data openneo_impress items item_translations pet_types pet_states swf_assets > scripts/setup-mysql-dev-schema.sql && yarn --silent mysqldump openneo_impress species species_translations colors color_translations > scripts/setup-mysql-dev-constants.sql", + "download-mysql-schema": "yarn --silent mysqldump --no-data openneo_impress items item_translations pet_types pet_states swf_assets | sed 's/ AUTO_INCREMENT=[0-9]*//g' > scripts/setup-mysql-dev-schema.sql && yarn --silent mysqldump openneo_impress species species_translations colors color_translations > scripts/setup-mysql-dev-constants.sql", "setup-mysql": "yarn mysql-admin < scripts/setup-mysql.sql", "setup-mysql-dev": "yarn mysql-dev < scripts/setup-mysql-dev-constants.sql && yarn mysql-dev < scripts/setup-mysql-dev-schema.sql", "build-cached-data": "node -r dotenv/config scripts/build-cached-data.js", diff --git a/scripts/setup-mysql-dev-constants.sql b/scripts/setup-mysql-dev-constants.sql index b1911cb..943c270 100644 --- a/scripts/setup-mysql-dev-constants.sql +++ b/scripts/setup-mysql-dev-constants.sql @@ -133,4 +133,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-09-19 3:34:44 +-- Dump completed on 2020-09-19 4:00:01 diff --git a/scripts/setup-mysql-dev-schema.sql b/scripts/setup-mysql-dev-schema.sql index 315d516..63c252b 100644 --- a/scripts/setup-mysql-dev-schema.sql +++ b/scripts/setup-mysql-dev-schema.sql @@ -41,7 +41,7 @@ CREATE TABLE `items` ( `modeling_status_hint` enum('done','glitchy') COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `objects_last_spidered` (`last_spidered`) -) ENGINE=InnoDB AUTO_INCREMENT=81718 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -65,7 +65,7 @@ CREATE TABLE `item_translations` ( KEY `index_item_translations_on_locale` (`locale`), KEY `index_item_translations_name` (`name`), KEY `index_item_translations_on_item_id_and_locale` (`item_id`,`locale`) -) ENGINE=InnoDB AUTO_INCREMENT=215780 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -85,7 +85,7 @@ CREATE TABLE `pet_types` ( `basic_image_hash` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `pet_types_species_color` (`species_id`,`color_id`) -) ENGINE=InnoDB AUTO_INCREMENT=4795 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -107,7 +107,7 @@ CREATE TABLE `pet_states` ( `artist_neopets_username` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `pet_states_pet_type_id` (`pet_type_id`) -) ENGINE=InnoDB AUTO_INCREMENT=28561 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -136,7 +136,7 @@ CREATE TABLE `swf_assets` ( KEY `swf_assets_body_id_and_object_id` (`body_id`), KEY `idx_swf_assets_zone_id` (`zone_id`), KEY `swf_assets_type_and_id` (`type`,`remote_id`) -) ENGINE=InnoDB AUTO_INCREMENT=521790 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -148,4 +148,4 @@ CREATE TABLE `swf_assets` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-09-19 3:34:36 +-- Dump completed on 2020-09-19 3:59:55 diff --git a/src/server/query-tests/__snapshots__/Pet.test.js.snap b/src/server/query-tests/__snapshots__/Pet.test.js.snap index 3f6a1af..b6c1a55 100644 --- a/src/server/query-tests/__snapshots__/Pet.test.js.snap +++ b/src/server/query-tests/__snapshots__/Pet.test.js.snap @@ -492,7 +492,7 @@ Array [ "SELECT * FROM pet_states WHERE (pet_type_id = ? AND swf_asset_ids = ?)", Array [ Array [ - "4795", + "1", "21057,21060,24008,7941,7942,7946", ], ], @@ -503,7 +503,7 @@ Array [ false, true, 2, - "4795", + "1", "21057,21060,24008,7941,7942,7946", false, ], @@ -589,7 +589,7 @@ Object { ], "petAppearance": Object { "bodyId": "180", - "id": "28561", + "id": "1", "pose": "SAD_MASC", }, } @@ -636,7 +636,7 @@ Array [ ORDER BY (mood_id IS NULL) ASC, mood_id ASC, female DESC, unconverted DESC, glitched ASC, id DESC", Array [ - "4795", + "1", ], ], ] @@ -981,7 +981,7 @@ Array [ "SELECT * FROM pet_states WHERE (pet_type_id = ? AND swf_asset_ids = ?)", Array [ Array [ - "4795", + "1", "21057,21060,24008,7941,7942,7946", ], ], @@ -992,7 +992,7 @@ Array [ false, true, 2, - "4795", + "1", "21057,21060,24008,7941,7942,7946", false, ],