-- +goose Up
-- +goose StatementBegin
ALTER TABLE "Inventory" RENAME COLUMN IsTemplate TO IsTemplate_old;
ALTER TABLE "Inventory" RENAME COLUMN PowerState TO PowerState_old;
ALTER TABLE "Inventory" RENAME COLUMN SrmPlaceholder TO SrmPlaceholder_old;
ALTER TABLE "Inventory" ADD COLUMN IsTemplate TEXT NOT NULL DEFAULT "FALSE";
ALTER TABLE "Inventory" ADD COLUMN PoweredOn TEXT NOT NULL DEFAULT "FALSE";
ALTER TABLE "Inventory" ADD COLUMN SrmPlaceholder TEXT NOT NULL DEFAULT "FALSE";
UPDATE Inventory
SET IsTemplate = CASE 
    WHEN IsTemplate_old = 1 THEN 'TRUE'
    ELSE 'FALSE'
END;
UPDATE Inventory
SET PoweredOn = CASE 
    WHEN PowerState_old = 1 THEN 'TRUE'
    ELSE 'FALSE'
END;
UPDATE Inventory
SET SrmPlaceholder = CASE 
    WHEN SrmPlaceholder_old = 1 THEN 'TRUE'
    ELSE 'FALSE'
END;
ALTER TABLE "Inventory" DROP COLUMN IsTemplate_old;
ALTER TABLE "Inventory" DROP COLUMN PowerState_old;

ALTER TABLE "Inventory" DROP COLUMN SrmPlaceholder_old;
-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin
ALTER TABLE "Inventory" RENAME COLUMN IsTemplate TO IsTemplate_old;
ALTER TABLE "Inventory" RENAME COLUMN PoweredOn TO PoweredOn_old;
ALTER TABLE "Inventory" RENAME COLUMN SrmPlaceholder TO SrmPlaceholder_old;
ALTER TABLE "Inventory" ADD COLUMN IsTemplate INTEGER;
ALTER TABLE "Inventory" ADD COLUMN PowerState INTEGER;
ALTER TABLE "Inventory" ADD COLUMN SrmPlaceholder INTEGER;
UPDATE Inventory
SET IsTemplate = CASE 
    WHEN IsTemplate_old = 'TRUE' THEN 1
    ELSE 0
END;
UPDATE Inventory
SET PowerState = CASE 
    WHEN PoweredOn_old = 'TRUE' THEN 1
    ELSE 0
END;
UPDATE Inventory
SET SrmPlaceholder = CASE 
    WHEN SrmPlaceholder_old = 'TRUE' THEN 1
    ELSE 0
END;
ALTER TABLE "Inventory" DROP COLUMN IsTemplate_old;
ALTER TABLE "Inventory" DROP COLUMN PoweredOn_old;
ALTER TABLE "Inventory" DROP COLUMN SrmPlaceholder_old;
-- +goose StatementEnd
