alter table `Group` add column parent_group_id INTEGER default 0;  -- Replace `Group` if you configured table `Group` to another name.

ALTER TABLE Binding ADD id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;

ALTER TABLE LDAPConfig ADD id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;

ALTER TABLE OrgUser DROP primary key;
ALTER TABLE OrgUser ADD id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;
ALTER TABLE OrgUser ADD UNIQUE (org_id, email);

ALTER TABLE OrgGroup DROP primary key;
ALTER TABLE OrgGroup ADD id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;
ALTER TABLE OrgGroup ADD UNIQUE (org_id, group_id);

ALTER TABLE GroupUser DROP primary key;
ALTER TABLE GroupUser ADD id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;
ALTER TABLE GroupUser ADD UNIQUE (group_id, user_name);

ALTER TABLE GroupDNPair ADD id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;
