ALTER TABLE iam_roles RENAME COLUMN arn TO iam_role;

ALTER TABLE iam_roles
    DROP CONSTRAINT unique_iam_role,
    DROP CONSTRAINT unique_service_id_label,
    DROP CONSTRAINT iam_roles_service_id_fkey,
    ADD CONSTRAINT environments_service_id_fkey FOREIGN KEY (service_id) REFERENCES services (id)
        ON UPDATE CASCADE,
    ALTER COLUMN cloudformation_status TYPE VARCHAR (200);

ALTER SEQUENCE iam_roles_id_seq RENAME TO environments_id_seq;

ALTER INDEX iam_roles_pkey RENAME TO environments_pkey;

ALTER TABLE iam_roles RENAME TO environments;
