ALTER TABLE tenants
    DROP COLUMN IF EXISTS status;

ALTER TABLE tenants
    DROP COLUMN IF EXISTS created_by;

DROP TYPE IF EXISTS tenant_status;

CREATE TYPE tenant_status AS ENUM ('creating', 'active', 'suspended', 'deleting', 'error');

ALTER TABLE tenants
    ADD COLUMN status tenant_status,
    ADD COLUMN created_by UUID;

UPDATE tenants
SET status = 'active';

ALTER TABLE tenants
    ALTER COLUMN status SET NOT NULL;
