mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-27 06:41:18 +00:00
15 lines
351 B
MySQL
15 lines
351 B
MySQL
|
-- Add the column back
|
||
|
alter table site add column creator_id int references person on update cascade on delete cascade;
|
||
|
|
||
|
-- Add the data, selecting the highest admin
|
||
|
update site
|
||
|
set creator_id = sub.id
|
||
|
from (
|
||
|
select id from person
|
||
|
where admin = true
|
||
|
limit 1
|
||
|
) as sub;
|
||
|
|
||
|
-- Set to not null
|
||
|
alter table site alter column creator_id set not null;
|