1 -- Add case insensitive username and email uniqueness
3 -- An example of showing the dupes:
6 -- lower(name) as lname,
9 -- group by lower(name)
10 -- having count(*) > 1;
12 -- Delete username dupes, keeping the first one
18 group by lower(name), lower(fedi_name)
22 create unique index idx_user_name_lower on user_ (lower(name));
25 create unique index idx_user_email_lower on user_ (lower(email));
27 -- Set empty emails properly to null
28 update user_ set email = null where email = '';