mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-10-01 01:36:12 -04:00
c3d64f996e
* Removing community.creator column. Fixes #1504 * Fixing unit tests. * Fixing federation tests.
25 lines
519 B
SQL
25 lines
519 B
SQL
|
|
-- Add the column back
|
|
alter table community add column creator_id int references person on update cascade on delete cascade;
|
|
|
|
-- Recreate the index
|
|
create index idx_community_creator on community (creator_id);
|
|
|
|
-- Add the data, selecting the highest mod
|
|
update community
|
|
set creator_id = sub.person_id
|
|
from (
|
|
select
|
|
cm.community_id,
|
|
cm.person_id
|
|
from
|
|
community_moderator cm
|
|
limit 1
|
|
) as sub
|
|
where id = sub.community_id;
|
|
|
|
-- Set to not null
|
|
alter table community alter column creator_id set not null;
|
|
|
|
|