forked from e621ng/e621ng
Fix post set migration
This commit is contained in:
parent
621df484f5
commit
8e117f4a2f
4
script/e6_migration/000_drop_unused_tables.sql
Normal file
4
script/e6_migration/000_drop_unused_tables.sql
Normal file
@ -0,0 +1,4 @@
|
||||
DROP TABLE IF EXISTS lol, restricted, table_data, servers, server_keys, stats, user_blacklisted_tags_backup, user_metadata;
|
||||
DROP TABLE IF EXISTS posts_tags, locked_post_tags;
|
||||
DROP TABLE IF EXISTS mod_menu, mod_queue_posts;
|
||||
DROP TABLE IF EXISTS tag_subscriptions;
|
@ -1,7 +1,16 @@
|
||||
begin;
|
||||
alter table set_maintainers rename to post_set_maintainers;
|
||||
|
||||
alter table post_sets rename column transfer_to_parent_on_delete to transfer_on_delete;
|
||||
alter table post_sets rename column public to is_public;
|
||||
alter table post_sets rename column user_id to creator_id;
|
||||
alter table post_sets add column creator_ip_addr inet,
|
||||
add column post_ids integer[] not null default '{}'::integer[];
|
||||
add column post_ids integer[] not null default '{}'::integer[];
|
||||
|
||||
create index set_posts on set_entries(post_set_id);
|
||||
update post_sets set post_ids = (select coalesce(array_agg(x.post_id), '{}'::integer[]) from (select _.post_id from set_entries _ where _.post_set_id = post_sets.id order by _.position) x);
|
||||
UPDATE post_sets SET post_count = COALESCE(array_length(post_ids, 1), 0);
|
||||
drop index set_posts;
|
||||
|
||||
drop table set_entries;
|
||||
commit;
|
||||
|
Loading…
Reference in New Issue
Block a user