Migration script to update weaver_users with duplicate netid after migrating uin to netid:
WITH duplicate_netids AS (
SELECT netid, COUNT(*) AS count FROM weaver_users GROUP BY netid HAVING COUNT(*) > 1
)
UPDATE weaver_users SET netid = NULL FROM duplicate_netids WHERE weaver_users.netid = duplicate_netids.netid AND weaver_users.email NOT LIKE '%tamu.edu';
Migration script to add unique constraint on weaver_users netid:
ALTER TABLE weaver_users ADD CONSTRAINT weaver_users_netid UNIQUE (netid);
Migration script to update weaver_users with duplicate netid after migrating uin to netid:
Migration script to add unique constraint on weaver_users netid: