sql fixes
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
set statement_timeout = 0;
|
set statement_timeout = 0;
|
||||||
delete from posts where id < 1140000;
|
delete from posts where id < (select max(id) - 50000 from posts);
|
||||||
delete from post_appeals where post_id < 1140000;
|
delete from post_appeals where post_id < (select max(id) - 50000 from posts);
|
||||||
vacuum analyze;
|
vacuum analyze;
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
alter table posts add column fav_string text not null default '';
|
alter table posts add column fav_string text not null default '';
|
||||||
alter table posts add column pool_string text not null default '';
|
alter table posts add column pool_string text not null default '';
|
||||||
|
|
||||||
-- TODO: REVERT
|
update posts set fav_string = (select coalesce(array_to_string(array_agg('fav:' || _.user_id), ' '), '') from favorites _ where _.post_id = posts.id);
|
||||||
update posts set fav_string = (select coalesce(array_to_string(array_agg('fav:' || _.user_id), ' '), '') from favorites _ where _.post_id = posts.id) where posts.id < 1000;
|
update posts set pool_string = (select coalesce(array_to_string(array_agg('pool:' || _.pool_id), ' '), '') from pools_posts _ where _.post_id = posts.id);
|
||||||
|
|
||||||
-- TODO: REVERT
|
|
||||||
update posts set pool_string = (select coalesce(array_to_string(array_agg('pool:' || _.pool_id), ' '), '') from pools_posts _ where _.post_id = posts.id) where posts.id < 1000;
|
|
||||||
|
|
||||||
create index index_advertisements_on_ad_type on advertisements (ad_type);
|
create index index_advertisements_on_ad_type on advertisements (ad_type);
|
||||||
|
|
||||||
@@ -3324,6 +3321,13 @@ COPY schema_migrations (version) FROM stdin;
|
|||||||
20111101212358
|
20111101212358
|
||||||
\.
|
\.
|
||||||
|
|
||||||
|
-- reindex
|
||||||
|
update posts set id = id;
|
||||||
|
update artists set id = id;
|
||||||
|
update dmails set id = id;
|
||||||
|
update forum_topics set id = id;
|
||||||
|
update forum_posts set id = id;
|
||||||
|
|
||||||
-- post processing
|
-- post processing
|
||||||
drop table pools_posts;
|
drop table pools_posts;
|
||||||
drop function pools_posts_delete_trg();
|
drop function pools_posts_delete_trg();
|
||||||
|
|||||||
Reference in New Issue
Block a user