Backstory: I had a debian 11 VPS. I installed the postgresql program from the debian 11 apt repo, back a few months ago. Back then, it was postgres 13 on the debian stable repos.

Fast forward couple months: debian 12 comes out. I do a “apt dist-upgrade” and in-place upgrade my VPS from debian 11 to debian 12. Along with this upgrade, comes postgresql 15 installed.

Now, fast forward couple more months: lemmy 0.18.3 comes out. I do not upgrade (I am on lemmy 0.18.2—afaik).

Fast forward some time, too: lemmy 0.18.4 comes out. I decide to upgrade to 0.18.4 from my existing 0.18.2.

I pull the git repo. Compile it locally. It goes well, no errors in the compilation process. I stop the lemmy systemd service, then I “mv” the compiled “lemmy_server” to /usr/bin dir.

I try to restart the now-upgraded lemmy systemd service. However, the systemd service fails.

I check the sudo journalctl -fu lemmy and I see the following error message:

lemmy_server[17631]: thread 'main' panicked at 'Couldn't run DB Migrations: Failed to run 2023-07-08-101154_fix_soft_delete_aggregates with: syntax error at or near "trigger"', crates/db_schema/src/utils.rs:221:25 

I report this issue here: https://github.com/LemmyNet/lemmy/issues/3756#issuecomment-1686439103

However, after a few back and forths and internet search, I conclude that somewhere between lemmy 0.18.3 and 0.18.4, lemmy stops supporting psql <15. So, my existing DB is not compatible.

Upon my investigation on my VPS setup, I concluded that psql 15 is running, however, lemmy is using the psql 13 tables (I do not know if this is the correct term).

Now my question: is there a way to import the lemmy data I had in the psql 13 tables to a new psql 15 table (or database, I don’t know the term).

To make things hairier: I also run a dendrite server on the same VPS, and the dendrite server is using the psql 15 with psql 13 tables on the same database as the lemmy one.

The dendrite database is controlled by a psql user named “dendrite” and the lemmy database is controlled by a psql user named “lemmy” . I hope this makes differentiation between two databases possible. And so I do not harm my existing dendrite database.

Any recommendations about my options here?

  • RoundSparrow @ BT@bulletintree.comM
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    1 year ago

    Ok, so what you are looking for is up to this point, especially the line starting with '1"

    COPY public.site (id, name, sidebar, published, updated, icon, banner, description, actor_id, last_refreshed_at, inbox_url, private_key, public_key, instance_id) FROM stdin;
    1	lemmy-gamma	\N	2023-08-16 21:42:52.88018	2023-08-16 21:47:45.32338	\N	\N	\N	http://lemmy-gamma:8561/	2023-08-16 21:42:52.877719http://lemmy-gamma:8561/site_inbox	-----BEGIN PRIVATE KEY-----\n
    
    • Anark KarabeyOP
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      I got only one instance of COPY public.site [...] followed by a line starting with '1".

      • RoundSparrow @ BT@bulletintree.comM
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        Going back to the output you got… line one, what are the dates you see?

        COPY public.site (id, name, sidebar, published, updated, icon, banner, description, actor_id, last_refreshed_at, inbox_url, private_key, public_key, instance_id) FROM stdin;
        1	lemmy-gamma	\N	2023-08-16 21:42:52.88018	2023-08-16 21:47:45.32338	
        
        • Anark KarabeyOP
          link
          fedilink
          arrow-up
          2
          ·
          1 year ago
          1       New Site        \N      2023-08-22 22:38:51.37196       \N      \N      \N      \N      https://domain.tld/   2023-08-22 22:38:51.364569    h
          ttps://domain.tld/site_inbox
          

          domain.tld is my instance’s domain name which I have redacted.

          and then it lists my instance’s private key.

            • Anark KarabeyOP
              link
              fedilink
              arrow-up
              1
              ·
              1 year ago
              user@server:~$ grep --after-context=6 "Data for Name: site; Type: TABLE DATA;" lemmy_databackup.sql
              -- Data for Name: site; Type: TABLE DATA; Schema: public; Owner: lemmy
              --
              
              COPY public.site (id, name, sidebar, published, updated, icon, banner, description, actor_id, last_refreshed_at, inbox_url, private_key, public_key, in
              stance_id) FROM stdin;
              288     ixs.io  \N      2023-08-08 02:09:06.130559      2023-08-06 20:06:24.355929      \N      \N      \N      https://lemmy.ixs.io/   2023-08-08 02:0
              9:06.129933     https://lemmy.ixs.io/site_inbox \N      -----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzneO9gfXYODqP77H882a\n6
              H96dtHqo5s2dLfl/ONOmh29CMT6WAzzql2TLiC0suc7ymntjpGbyTHlR7JSkBVS\n3bhHayaDxlp1ZsYGlDcyaas3d+5V6po4tH96Qkyks5A7gEHpQjTAtLyiZplavMXg\nBFxBLzUiVllMq64KM/1z
              1r1cdjlbtJvdtb0q12UuDm2Kc1ruJCLQU+MpWnzmQLqB\naDsLneZKYzore27cPT3cxRA49dnhgxVbWb+GYDZfvFPTk9Dilq4UuzEH3025SNHZ\n+fzITMX7DkEdZ2k7GWu/kYYm3e6KES9/wcfo3O/
              GqIDUPgSn8yvhUSfFGaw5Q4h1\nsQIDAQAB\n-----END PUBLIC KEY-----\n 106
              57      LOL! I'm Beer.  Like, just don't be a dick, man.\n\nCh
              

              and goes on and on listing other instances. It doens’t show mine.

              • RoundSparrow @ BT@bulletintree.comM
                link
                fedilink
                arrow-up
                1
                ·
                1 year ago

                ok, I’m not that great with grep, I suppose we could tell it to use only lines that start with 1 etc.

                You seem willing to start over. You are now on PostgreSQL15.3 and Lemmy 0.18.4 - so it’s up to you.

                • Anark KarabeyOP
                  link
                  fedilink
                  arrow-up
                  2
                  ·
                  1 year ago

                  You seem willing to start over. You are now on PostgreSQL15.3 and Lemmy 0.18.4 - so it’s up to you.

                  Alright. I will do that. RIP my old instance and its data. Welcome a new instance and its future data.

                  Thanks for the help effort that stretched into 3 days. I appreciate it.