1. Currently, there is a new requirement to initialize data for the product during deployment. I prepared the corresponding SQL file in advance. Because I need to execute multiple SQL statements, and subsequent SQL statements depend on the primary key IDs generated by previous SQL statements, I need to define and use variables in the SQL file.
2. The SQL statements in the SQL file are as follows:
INSERT INTO `operation_types`(`alias`, `name`) VALUES ('mrfl', '默认分类');
SET @typeId = (SELECT `id` FROM `operation_types` WHERE `alias` = 'mrfl' ORDER BY `id` DESC LIMIT 0,1);
INSERT INTO `operation_products`(`activity_name`, `product_name`, `quantity`, `status`, `create_by`, `exchange_quantity`, `create_time`, `modify_time`, `start_time`, `validity_date`, `credits1`, `credits2`, `credits3`, `exchange_times`, `thumb_img`, `banner_img`, `accept_way`, `accept_addr`, `link_man`, `link_phone`, `accept_time`, `accept_time_desc`, `member_nums`, `participation_nums`, `sort`, `end_time`, `type`, `market_price`, `order_start_time`, `order_end_time`, `rank`, `catalog`, `product_type`) VALUES ('默认商品', '商品简介', 1, 1, 0, 0, 1597650329, 1597650329, 1597593600, 0, 1, NULL, NULL, 1, '/upload/20200817/20203554555373.png', '/upload/20200817/20202146638315.png', 1, '中国(四川)自由贸易试验区成都高新区天府五街200号4号楼A区9楼', '华栖云', '13888888888', 2, '', 0, 0, 0, 2147483647, 2, 1, 1597593600, 2147483647, 1, @typeId, 1);
SET @productId = (SELECT `id` FROM `operation_products` WHERE `activity_name` = '默认商品' AND `catalog` = @typeId ORDER BY `id` DESC LIMIT 0,1);
INSERT INTO `operation_product_imgs`(`id`, `content`, `count`) VALUES (@productId, 'a:2:{i:0;s:35:\"/upload/20200817/20201164114857.png\";i:1;s:35:\"/upload/20200817/20202503127232.png\";}', 2);
INSERT INTO `operation_version`(`version`, `update_time`) VALUES ('3.2.0', NOW());3. Check the table: operation_types, the id value of its last record is 19. Check the table: operation_products, the catalog value of its last record is 19. Check the table: operation_product_imgs, the id value of its last record is 95. As shown in Figure 1

4. Run the SQL file, [SQL] Query creditbak_patch_3.2.0 start. [SQL] Finished successfully. It ran successfully. As shown in Figure 2
![Run the SQL file, [SQL] Query creditbak_patch_3.2.0 start. [SQL] Finished successfully. It ran successfully.](https://media.shuijingwanwq.com/2020/08/2-10.png)
5. Check the table: operation_types, the id value of its last record is 20. Check the table: operation_products, the catalog value of its last record is 20. Check the table: operation_product_imgs, the id value of its last record is 96. This matches expectations. As shown in Figure 3

