0
|
1 ALTER TABLE "cache" ADD expires timestamp with time zone DEFAULT NULL;
|
|
2 ALTER TABLE "cache_shared" ADD expires timestamp with time zone DEFAULT NULL;
|
|
3 ALTER TABLE "cache_index" ADD expires timestamp with time zone DEFAULT NULL;
|
|
4 ALTER TABLE "cache_thread" ADD expires timestamp with time zone DEFAULT NULL;
|
|
5 ALTER TABLE "cache_messages" ADD expires timestamp with time zone DEFAULT NULL;
|
|
6
|
|
7 -- initialize expires column with created/changed date + 7days
|
|
8 UPDATE "cache" SET expires = created + interval '604800 seconds';
|
|
9 UPDATE "cache_shared" SET expires = created + interval '604800 seconds';
|
|
10 UPDATE "cache_index" SET expires = changed + interval '604800 seconds';
|
|
11 UPDATE "cache_thread" SET expires = changed + interval '604800 seconds';
|
|
12 UPDATE "cache_messages" SET expires = changed + interval '604800 seconds';
|
|
13
|
|
14 DROP INDEX cache_created_idx;
|
|
15 DROP INDEX cache_shared_created_idx;
|
|
16 ALTER TABLE "cache_index" DROP "changed";
|
|
17 ALTER TABLE "cache_thread" DROP "changed";
|
|
18 ALTER TABLE "cache_messages" DROP "changed";
|
|
19
|
|
20 CREATE INDEX cache_expires_idx ON "cache" (expires);
|
|
21 CREATE INDEX cache_shared_expires_idx ON "cache_shared" (expires);
|
|
22 CREATE INDEX cache_index_expires_idx ON "cache_index" (expires);
|
|
23 CREATE INDEX cache_thread_expires_idx ON "cache_thread" (expires);
|
|
24 CREATE INDEX cache_messages_expires_idx ON "cache_messages" (expires);
|