/dump-to-database-yshop Secret
Last active
August 29, 2015 14:23
-
-
Save SkyBirdSoar/6948924e4e39c9140804 to your computer and use it in GitHub Desktop.
This file contains 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
UPDATE codes SET code='MKGB47B7', status=1, students_licences='1', licences_used='0', unlock_date=1433421747, licence_till=1465044147, user_id='21465', school_id='14363', comment='Nsomethisdfvklas fjs kasldf jasf asid.' WHERE id='47923' | |
/*!*/; | |
SET INSERT_ID=283418/*!*/; | |
SET INSERT_ID=21477/*!*/; | |
INSERT INTO `user` (^M | |
login,^M | |
password,^M | |
password_salt,^M | |
role_id,^M | |
firstname,^M | |
lastname,^M | |
email,^M | |
processallow,^M | |
allow_remind_email,^M | |
created,^M | |
sso_id,^M | |
quota,^M | |
trial_period_date,^M | |
active,^M | |
creator_id,^M | |
info_message_counter,^M | |
giodo_accept_date,^M | |
uid^M | |
) VALUES(^M | |
'name',^M | |
'2afbe78dhash3',^M | |
'9saltd',^M | |
4,^M | |
'Cdne',^M | |
'Hnameryx',^M | |
'cheaddressx@ddd.org',^M | |
1,^M | |
1,^M | |
1433423297,^M | |
'38748eb6893b9ebe7cf00',^M | |
'50',^M | |
0,^M | |
'1',^M | |
0,^M | |
0,^M | |
0,^M | |
'38748eb68cf00'^M | |
) | |
/*!*/; | |
SET INSERT_ID=2170744/*!*/; | |
SET INSERT_ID=2170745/*!*/; |
This file contains 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
46923 |
This file contains 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
require 'set' | |
ids_to_change = Set.new | |
# Get the IDs to change | |
File.open("ids_to_change_all_uniq").each_line do |line| | |
# Each line contains an id only | |
# Eg | |
# | 10942 | |
# | 10344 | |
ids_to_change << line.to_i | |
end | |
change_id = lambda { |id| id + 1000 } | |
output = File.open("dump-to-database-yshop", "w") | |
File.open("yshop_14-megaslice").each_line do |line| | |
# Instructions of SQL | |
changed_line = line | |
line.scan(/\d+/).each do |number| # Extract from lines some numbers. | |
changed_line.sub!(/\b#{number}\b/, change_id.call(number.to_i).to_s) if ids_to_change.include? number.to_i | |
end | |
output.print changed_line | |
end | |
output.close | |
This file contains 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
UPDATE codes SET code='MKGB47B7', status=1, students_licences='1', licences_used='0', unlock_date=1433421747, licence_till=1465044147, user_id='21465', school_id='14363', comment='Nsomethisdfvklas fjs kasldf jasf asid.' WHERE id='46923' | |
/*!*/; | |
SET INSERT_ID=283418/*!*/; | |
SET INSERT_ID=21477/*!*/; | |
INSERT INTO `user` (^M | |
login,^M | |
password,^M | |
password_salt,^M | |
role_id,^M | |
firstname,^M | |
lastname,^M | |
email,^M | |
processallow,^M | |
allow_remind_email,^M | |
created,^M | |
sso_id,^M | |
quota,^M | |
trial_period_date,^M | |
active,^M | |
creator_id,^M | |
info_message_counter,^M | |
giodo_accept_date,^M | |
uid^M | |
) VALUES(^M | |
'name',^M | |
'2afbe78dhash3',^M | |
'9saltd',^M | |
4,^M | |
'Cdne',^M | |
'Hnameryx',^M | |
'cheaddressx@ddd.org',^M | |
1,^M | |
1,^M | |
1433423297,^M | |
'38748eb6893b9ebe7cf00',^M | |
'50',^M | |
0,^M | |
'1',^M | |
0,^M | |
0,^M | |
0,^M | |
'38748eb68cf00'^M | |
) | |
/*!*/; | |
SET INSERT_ID=2170744/*!*/; | |
SET INSERT_ID=2170745/*!*/; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment