-- 1534475443 UP update-companies
DELETE FROM companies where code in
('BES', 'BSA', 'HM', 'FCF', 'INT', 'JS', 'MV', 'ORA', 'SK', 'SLO', 'WE', 'MPI');

INSERT INTO companies (code, name, data)
VALUES
('BES', 'Brian & Erin Skarbek', '{:locations ["CB"] }'),
('BSA', 'Be Steak A', '{:locations ["CB"] }'),
('HM', 'Hiro Mura', '{:locations ["SV"] }'),
('FCF', 'Frost Cupcake Factory', '{:locations ["CB"] }'),
('INT', 'Integreat', '{:locations ["CB"] }'),
('JS', 'Jason Skarbek', '{:locations ["CB"] }'),
('MV', 'Mio Vicino - Santa Clara', '{:locations ["SC"] }'),
('MPI', 'Moscini Pizza', '{:locations ["CB"] }'),
('ORA', 'Orale''s', '{:locations ["CB"] }'),
('SK', 'Savory Kitchen', '{:locations ["AL"] }'),
('SLO', 'Skarbek Law Offices', '{:locations ["CB"] }'),
('WE', 'Warm Elements', '{:locations ["CB"] }');

DELETE FROM invoices_expense_accounts where invoice_id in (select id from invoices where company_id in (select id from companies where name in ('Knock Out Grill & Bar', 'Nasch Bistro', 'Naschmarkt', 'The Socialight')));
DELETE FROM invoices_checks where invoice_id in (select id from invoices where company_id in (select id from companies where name in ('Knock Out Grill & Bar', 'Nasch Bistro', 'Naschmarkt', 'The Socialight')));

DELETE FROM invoices where company_id in (select id from companies where name in ('Knock Out Grill & Bar', 'Nasch Bistro', 'Naschmarkt', 'The Socialight'));
DELETE FROM checks where company_id in (select id from companies where name in ('Knock Out Grill & Bar', 'Nasch Bistro', 'Naschmarkt', 'The Socialight'));
DELETE FROM companies where name in ('Knock Out Grill & Bar', 'Nasch Bistro', 'Naschmarkt', 'The Socialight');
