合并商品编号迁移
This commit is contained in:
@@ -150,9 +150,13 @@ BEGIN
|
||||
SET deposit_val = 100.00 + (i % 10) * 50.00;
|
||||
|
||||
INSERT INTO rental_listings (
|
||||
account_id, owner_id, price, deposit_amount,
|
||||
listing_no, account_id, owner_id, price, deposit_amount,
|
||||
in_transaction, status, review_status, published_at
|
||||
) VALUES (
|
||||
CONCAT(
|
||||
DATE_FORMAT(DATE_SUB(NOW(), INTERVAL (i % 90) DAY), '%Y%m%d'),
|
||||
LPAD(FLOOR((i - 1) / 90) + 1, 4, '0')
|
||||
),
|
||||
account_id_val,
|
||||
user_id_val,
|
||||
price_val,
|
||||
@@ -178,6 +182,12 @@ BEGIN
|
||||
END IF;
|
||||
END WHILE;
|
||||
|
||||
INSERT INTO listing_no_sequences (biz_date, next_seq)
|
||||
SELECT LEFT(listing_no, 8), MAX(CAST(SUBSTRING(listing_no, 9) AS UNSIGNED))
|
||||
FROM rental_listings
|
||||
GROUP BY LEFT(listing_no, 8)
|
||||
ON DUPLICATE KEY UPDATE next_seq = GREATEST(next_seq, VALUES(next_seq));
|
||||
|
||||
COMMIT;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
||||
Reference in New Issue
Block a user