mirror of https://github.com/LemmyNet/lemmy
Merge branch 'main' into lemmynsfw-changes
commit
5fbba8a4cf
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,5 @@
|
||||
ALTER TABLE community
|
||||
DROP COLUMN visibility;
|
||||
|
||||
DROP TYPE community_visibility;
|
||||
|
@ -0,0 +1,8 @@
|
||||
CREATE TYPE community_visibility AS enum (
|
||||
'Public',
|
||||
'LocalOnly'
|
||||
);
|
||||
|
||||
ALTER TABLE community
|
||||
ADD COLUMN visibility community_visibility NOT NULL DEFAULT 'Public';
|
||||
|
@ -0,0 +1,48 @@
|
||||
-- Automatically resolve all reports for a given post once it is marked as removed
|
||||
CREATE OR REPLACE FUNCTION post_removed_resolve_reports ()
|
||||
RETURNS TRIGGER
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
BEGIN
|
||||
UPDATE
|
||||
post_report
|
||||
SET
|
||||
resolved = TRUE,
|
||||
resolver_id = NEW.mod_person_id,
|
||||
updated = now()
|
||||
WHERE
|
||||
post_report.post_id = NEW.post_id;
|
||||
RETURN NULL;
|
||||
END
|
||||
$$;
|
||||
|
||||
CREATE OR REPLACE TRIGGER post_removed_resolve_reports
|
||||
AFTER INSERT ON mod_remove_post
|
||||
FOR EACH ROW
|
||||
WHEN (NEW.removed)
|
||||
EXECUTE PROCEDURE post_removed_resolve_reports ();
|
||||
|
||||
-- Same when comment is marked as removed
|
||||
CREATE OR REPLACE FUNCTION comment_removed_resolve_reports ()
|
||||
RETURNS TRIGGER
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
BEGIN
|
||||
UPDATE
|
||||
comment_report
|
||||
SET
|
||||
resolved = TRUE,
|
||||
resolver_id = NEW.mod_person_id,
|
||||
updated = now()
|
||||
WHERE
|
||||
comment_report.comment_id = NEW.comment_id;
|
||||
RETURN NULL;
|
||||
END
|
||||
$$;
|
||||
|
||||
CREATE OR REPLACE TRIGGER comment_removed_resolve_reports
|
||||
AFTER INSERT ON mod_remove_comment
|
||||
FOR EACH ROW
|
||||
WHEN (NEW.removed)
|
||||
EXECUTE PROCEDURE comment_removed_resolve_reports ();
|
||||
|
@ -0,0 +1,8 @@
|
||||
DROP TRIGGER IF EXISTS post_removed_resolve_reports ON mod_remove_post;
|
||||
|
||||
DROP FUNCTION IF EXISTS post_removed_resolve_reports;
|
||||
|
||||
DROP TRIGGER IF EXISTS comment_removed_resolve_reports ON mod_remove_comment;
|
||||
|
||||
DROP FUNCTION IF EXISTS comment_removed_resolve_reports;
|
||||
|
@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
echo "Do not stop in the middle of this upgrade, wait until you see the message: Upgrade complete."
|
||||
|
||||
echo "Stopping lemmy and all services..."
|
||||
sudo docker-compose stop
|
||||
|
||||
echo "Make sure postgres is started..."
|
||||
sudo docker-compose up -d postgres
|
||||
echo "Waiting..."
|
||||
sleep 20s
|
||||
|
||||
echo "Exporting the Database to 15_16.dump.sql ..."
|
||||
sudo docker-compose exec -T postgres pg_dumpall -c -U lemmy > 15_16_dump.sql
|
||||
echo "Done."
|
||||
|
||||
echo "Stopping postgres..."
|
||||
sudo docker-compose stop postgres
|
||||
echo "Waiting..."
|
||||
sleep 20s
|
||||
|
||||
echo "Removing the old postgres folder"
|
||||
sudo rm -rf volumes/postgres
|
||||
|
||||
echo "Updating docker-compose to use postgres version 16."
|
||||
sed -i "s/image: postgres:.*/image: postgres:16-alpine/" ./docker-compose.yml
|
||||
|
||||
echo "Starting up new postgres..."
|
||||
sudo docker-compose up -d postgres
|
||||
echo "Waiting..."
|
||||
sleep 20s
|
||||
|
||||
echo "Importing the database...."
|
||||
cat 15_16_dump.sql | sudo docker-compose exec -T postgres psql -U lemmy
|
||||
echo "Done."
|
||||
|
||||
echo "Starting up lemmy..."
|
||||
sudo docker-compose up -d
|
||||
|
||||
echo "A copy of your old database is at 15_16.dump.sql . You can delete this file if the upgrade went smoothly."
|
||||
echo "Upgrade complete."
|
Loading…
Reference in New Issue