--liquibase formatted sql

--changeset damon.overboe:alter-organization-widen-qb-account-fields
ALTER TABLE organization
	MODIFY COLUMN expense_account VARCHAR(159) NOT NULL DEFAULT 'Transportation COGS'
	, MODIFY COLUMN ap_account VARCHAR(159) NOT NULL DEFAULT 'AP - Trade'
	, MODIFY COLUMN income_item VARCHAR(159) NOT NULL DEFAULT 'Transportation Other Item'
	, MODIFY COLUMN ar_account VARCHAR(159) NOT NULL DEFAULT 'A/R - Trade'
;



--changeset damon.overboe:hrn-changed-20170831 runOnChange:true
update organization
	set expense_account = 'Transportation COGS:H&R Construction'
		, ap_account = 'AP - Trade'
		, income_item = 'Transportation H&R'
		, ar_account = 'A/R - Trade'
	where
		id = 19
	;

--changeset lewis.stone:changed-prioritized-org-qb-mappings runOnChange:true
UPDATE organization SET `expense_account`='Transportation COGS:Isuzu', `income_item`='Transportation ISUZU' WHERE `id`='25';
UPDATE organization SET `expense_account`='Transportation COGS:COGS - Other', `income_item`='Transportation Sales' WHERE `id`='48';
UPDATE organization SET `expense_account`='Transportation COGS:Bobcat', `income_item`='Transportation Bobcat' WHERE `id`='4';

--changeset damon.overboe:alter-organization-expense-account-defaults
ALTER TABLE organization
	MODIFY COLUMN expense_account VARCHAR(159) NOT NULL DEFAULT 'Transportation COGS:COGS - Other'
,	MODIFY COLUMN income_item VARCHAR(159) NOT NULL DEFAULT 'Transportation Sales';


--changeset damon.overboe:update-organization-customers-20170918
UPDATE organization SET ar_account = 'A/R – Interco' WHERE ID = 18;
UPDATE organization SET ar_account = 'A/R – Interco' WHERE ID = 36;
UPDATE organization SET ar_account = 'A/R – Interco' WHERE ID = 37;
UPDATE organization SET ar_account = 'A/R – Interco' WHERE ID = 38;
UPDATE organization SET ar_account = 'A/R – Interco' WHERE ID = 39;
UPDATE organization SET ar_account = 'A/R – Interco' WHERE ID = 40;
UPDATE organization SET ar_account = 'A/R – Interco' WHERE ID = 49;
UPDATE organization SET expense_account = 'Transportation COGS:COGS - Other', income_item = 'Transportation Sales' WHERE ID = 2;
UPDATE organization SET expense_account = 'Transportation COGS:COGS - Other', income_item = 'Transportation Sales' WHERE ID = 3;
UPDATE organization SET expense_account = 'Transportation COGS:COGS - Other', income_item = 'Transportation Sales' WHERE ID = 5;
UPDATE organization SET expense_account = 'Transportation COGS:COGS - Other', income_item = 'Transportation Sales' WHERE ID = 6;
UPDATE organization SET expense_account = 'Transportation COGS:COGS - Other', income_item = 'Transportation Sales' WHERE ID = 7;
UPDATE organization SET expense_account = 'Transportation COGS:Ceramex', income_item = 'Ceramex' WHERE ID = 8;
UPDATE organization SET expense_account = 'Transportation COGS:CNHR Coreview', income_item = 'Transportation CNHR Coreview' WHERE ID = 9;
UPDATE organization SET expense_account = 'Transportation COGS:CNHR', income_item = 'Transportation - CNHR' WHERE ID = 10;
UPDATE organization SET expense_account = 'Transportation COGS:ConCurrent', income_item = 'Transportation ConCurrent' WHERE ID = 11;
UPDATE organization SET expense_account = 'Transportation COGS:CONEQUIP', income_item = 'Transportation CONEQUIP' WHERE ID = 12;
UPDATE organization SET expense_account = 'Transportation COGS:COGS - Other', income_item = 'Transportation Sales' WHERE ID = 13;
UPDATE organization SET expense_account = 'Transportation COGS:COGS - Other', income_item = 'Transportation Sales' WHERE ID = 15;
UPDATE organization SET expense_account = 'Transportation COGS:Doosan', income_item = 'Transportation Doosan' WHERE ID = 16;
UPDATE organization SET expense_account = 'Transportation COGS:Interco COGS:GRC', income_item = 'Transportation GRC' WHERE ID = 18;
UPDATE organization SET expense_account = 'Transportation COGS:COGS - Other', income_item = 'Transportation Sales' WHERE ID = 20;
UPDATE organization SET expense_account = 'Transportation COGS:COGS - Other', income_item = 'Transportation Sales' WHERE ID = 21;
UPDATE organization SET expense_account = 'Transportation COGS:COGS - Other', income_item = 'Transportation Sales' WHERE ID = 23;
UPDATE organization SET expense_account = 'Transportation COGS:COGS - Other', income_item = 'Transportation Sales' WHERE ID = 27;
UPDATE organization SET expense_account = 'Transportation COGS:COGS - Other', income_item = 'Transportation Sales' WHERE ID = 28;
UPDATE organization SET expense_account = 'Transportation COGS:Navistar', income_item = 'Transportation Sales  NAVISTAR' WHERE ID = 29;
UPDATE organization SET expense_account = 'Transportation COGS:COGS - Other', income_item = 'Transportation Sales' WHERE ID = 31;
UPDATE organization SET expense_account = 'Transportation COGS:COGS - Other', income_item = 'Transportation Sales' WHERE ID = 33;
UPDATE organization SET expense_account = 'Transportation COGS:SMC', income_item = 'Transportation  SMC' WHERE ID = 35;
UPDATE organization SET expense_account = 'Transportation COGS:Interco COGS:SRC Automotive', income_item = 'Transportation SRC Automotive' WHERE ID = 36;
UPDATE organization SET expense_account = 'Transportation COGS:Interco COGS:SRCE', income_item = 'Transportation SRCE' WHERE ID = 37;
UPDATE organization SET expense_account = 'Transportation COGS:Interco COGS:SRC HD', income_item = 'Transportation SRC HD' WHERE ID = 38;
UPDATE organization SET expense_account = 'Transportation COGS:Interco COGS:SRC LEX', income_item = 'Transportation SRC Lex' WHERE ID = 39;
UPDATE organization SET expense_account = 'Transportation COGS:Interco COGS:SRC PS', income_item = 'Transportation SRC PS' WHERE ID = 40;
UPDATE organization SET expense_account = 'Transportation COGS:COGS - Other', income_item = 'Transportation Sales' WHERE ID = 41;
UPDATE organization SET expense_account = 'Transportation COGS:Yanmar', income_item = 'Transportation Yanmar' WHERE ID = 42;
UPDATE organization SET expense_account = 'Transportation COGS:Yanmar', income_item = 'Transportation Yanmar' WHERE ID = 43;
UPDATE organization SET expense_account = 'Transportation COGS:COGS - Other', income_item = 'CDTI – Transportation' WHERE ID = 45;
UPDATE organization SET expense_account = 'Transportation COGS:Bobcat', income_item = 'Transportation Bobcat' WHERE ID = 46;
UPDATE organization SET expense_account = 'Transportation COGS:Bobcat', income_item = 'Transportation Bobcat' WHERE ID = 47;
UPDATE organization SET expense_account = 'Transportation COGS:COGS - Other', income_item = 'Transportation Sales' WHERE ID = 48;
UPDATE organization SET expense_account = 'Transportation COGS:Interco COGS:NewStream', income_item = 'Transportation NewStream' WHERE ID = 49;

--changeset damon.overboe:orgs-rename-for-golive-card-hnr-cogs#151827420
UPDATE organization
        SET expense_account = 'Transportation COGS:H&R Construction'
        WHERE id = 19;

--changeset damon.overboe:change-concurrent-152420363
UPDATE organization SET
	name = 'CONCURRENT',
	qb_name = 'CONCURRENT',
	expense_account = 'Transportation COGS:Concurrent',
	income_item = 'Transportation Concurrent'
WHERE ID = 11;
