-- +goose Up
-- +goose StatementBegin
ALTER TABLE facilities
  MODIFY COLUMN electric VARCHAR(255) NOT NULL DEFAULT '';
-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin
UPDATE facilities
SET electric = CASE
  WHEN LOWER(TRIM(electric)) IN ('', '0', 'false', 'no', 'n') THEN '0'
  ELSE '1'
END;

ALTER TABLE facilities
  MODIFY COLUMN electric TINYINT(1) NOT NULL DEFAULT 0;
-- +goose StatementEnd
