Created
May 29, 2018 07:52
-
-
Save bamoo456/96c90fa9830be57076c3168c71994852 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Check the fields of target table first | |
select column_name from information_schema.columns where table_schema = DATABASE() AND table_name='TestTable'; | |
-- Migrate the data to the trash | |
INSERT INTO Trash (model, modelId, eventId, content, createdAt, createdBy, updatedAt, updatedBy) | |
SELECT 'tablename', id as modelId, eventId, JSON_OBJECT("field1", field1, "field2", field2), CURRENT_TIME, 'test', CURRENT_TIME, 'test' from TestTable | |
WHERE id IN (123); | |
-- Remve the data from original table | |
-- commit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment