Skip to content

Instantly share code, notes, and snippets.

@btihen
Last active August 29, 2015 13:58
Show Gist options
  • Save btihen/10048345 to your computer and use it in GitHub Desktop.
Save btihen/10048345 to your computer and use it in GitHub Desktop.
Inventory DB updates
USE inventory;
#ALTER TABLE computers ADD fleet_id INT(11) AFTER id;
#UPDATE computers SET fleet_id=date_made WHERE date_made REGEXP '^-?[0-9]+$';
#SELECT fleet_id FROM computers;
ALTER TABLE computers ADD fleetid TEXT AFTER id;
UPDATE computers SET fleetid=fleet_id;
#ALTER TABLE computers DROP fleet_id;
ALTER TABLE computers ADD owner TEXT AFTER label_on;
UPDATE computers SET owner=label_on;
#SELECT label_on FROM computers;
ALTER TABLE computers ADD device_type TEXT AFTER status;
UPDATE computers SET device_type=return_reason;
#SELECT device_type FROM computers;
ALTER TABLE computers ADD brand TEXT AFTER device_type;
UPDATE computers SET brand=polyvision;
#SELECT brand FROM computers;
ALTER TABLE computers ADD ws_color TEXT AFTER ws_model;
UPDATE computers SET ws_color=damage;
#SELECT ws_color FROM computers;
ALTER TABLE computers ADD interfaces TEXT AFTER en1_ip;
UPDATE computers SET interfaces=verified_on;
#SELECT interfaces FROM computers;
ALTER TABLE computers ADD building TEXT AFTER backup_hd;
UPDATE computers SET building=backup_hd;
#SELECT building FROM computers;
ALTER TABLE computers ADD tech_note TEXT AFTER comments;
UPDATE computers SET tech_note=powersupply;
#SELECT tech_note FROM computers;
ALTER TABLE computers ADD ws_condition TEXT AFTER status;
#UPDATE computers SET ws_condition=damage WHERE damage REGEXP '^-?[A-D]$';
#SELECT ws_condition FROM computers;
ALTER TABLE computers ADD full_name TEXT AFTER issued_to;
# Eventually
#ALTER TABLE computers DROP date_made;
#ALTER TABLE computers DROP return_reason;
#ALTER TABLE computers DROP polyvision;
#ALTER TABLE computers DROP damage;
#ALTER TABLE computers DROP verified_on;
#ALTER TABLE computers DROP backup_hd;
#ALTER TABLE computers DROP powersupply;
#ALTER TABLE computers DROP comp_condition;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment