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
    1
    ·
    edit-2
    1 year ago

    ok, so, there is another possibility I hadn’t thought about…

    That this broken-state of “thinks it is new site” existed before we ever backed up your PostgreSQL 13 data.

    Do you still have your lemmy_server binary from version 0.18.2 that did work with postgreSQL 13?

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

      Do you still have your lemmy_server binary from version 0.18.2 that did work with postgreSQL 13?

      Unfortunately not. I have mv 'ed the newly compiled lemmy_server binary on top of the older one’s.

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

        well, now my theory is that your site was broken with the 0.18.4 upgrade somehow. And that the PostgreSQL 13 database wouldn’t even work with 0.18.2

        We could confirm this by you compiling with Rust the 0.18.2 and using it with your PostgreSQL 13 and see if it works like before you ever upgraded…

        But the migrations may have already made the database incompatible. But I think it has a down.sql to go back… also for sake of clarity: Do you have a backup before you upgraded to 0.18.4 ?

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

          Do you have a backup before you upgraded to 0.18.4 ?

          No. Unfortunately not.

          At this point, I sense that we are wearing down our options. If you see no more clear way to proceed, we can call it quits. I didn’t have much valuable posts, nor communities in there anyways. It was mostly experimental.

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

            Well, I’m at a loss. I never actually did a failed upgrade from 13, and I don’t know exactly what it fails on, etc. I just did a upgrade from 14 to 15 before I went with 0.18.4 - so I knew the upgrade procedure. But I didn’t expect you would be in a damaged state where it had you as a new instance.