mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-09-02 03:03:57 +00:00
* [0.19] Fixing active counts slow queries. (#5907) * Fixing active counts slow queries. * Simplify back to str tuple * Batch site and community updates * Using update from temp table * Making aggs temp table use interval name. * Make dev setup use optimized postgres. * Addressing PR comments. * Use ref * Removing system custom info from customPostgresql.conf * Forgot to remove old scheduled tasks. * Making sure migrations aren't missing anything from release/v0.19 Checked using git diff --diff-filter D --stat release/v0.19 migrations * Rename all migrations to come after release/v0.19 migrations * Add liked_at is not null check.
52 lines
1.2 KiB
PL/PgSQL
52 lines
1.2 KiB
PL/PgSQL
-- Remove private visibility
|
|
ALTER TYPE community_visibility RENAME TO community_visibility__;
|
|
|
|
CREATE TYPE community_visibility AS enum (
|
|
'Public',
|
|
'LocalOnly'
|
|
);
|
|
|
|
ALTER TABLE community
|
|
ALTER COLUMN visibility DROP DEFAULT;
|
|
|
|
ALTER TABLE community
|
|
ALTER COLUMN visibility TYPE community_visibility
|
|
USING visibility::text::community_visibility;
|
|
|
|
ALTER TABLE community
|
|
ALTER COLUMN visibility SET DEFAULT 'Public';
|
|
|
|
DROP TYPE community_visibility__;
|
|
|
|
-- Revert community follower changes
|
|
CREATE OR REPLACE FUNCTION convert_follower_state (s community_follower_state)
|
|
RETURNS bool
|
|
LANGUAGE sql
|
|
AS $$
|
|
SELECT
|
|
CASE WHEN s = 'Pending' THEN
|
|
TRUE
|
|
ELSE
|
|
FALSE
|
|
END
|
|
$$;
|
|
|
|
ALTER TABLE community_follower
|
|
ALTER COLUMN state TYPE bool
|
|
USING convert_follower_state (state);
|
|
|
|
DROP FUNCTION convert_follower_state;
|
|
|
|
ALTER TABLE community_follower
|
|
ALTER COLUMN state SET DEFAULT FALSE;
|
|
|
|
ALTER TABLE community_follower RENAME COLUMN state TO pending;
|
|
|
|
DROP TYPE community_follower_state;
|
|
|
|
ALTER TABLE community_follower
|
|
DROP COLUMN approver_id;
|
|
|
|
ALTER TABLE ONLY local_site
|
|
ALTER COLUMN federation_signed_fetch SET DEFAULT FALSE;
|
|
|