Skip to content

Conversation

Abestanis
Copy link
Contributor

@Abestanis Abestanis commented May 8, 2025

Hello, I tried updating from the (discontinued?) ghcr.io/beeper/linkedin:latest container to dock.mau.dev/mautrix/linkedin:latest (is that supported?) and run into the following error when starting the bridge:

"pq: column \"identifiers\" is of type jsonb but expression is of type text"

The ghost.identifiers column has the type jsonb:
https://github.com/mautrix/go/blob/27769dfc98bebdcec16bb2293029904109a2b9df/bridgev2/database/upgrades/00-latest.sql#L80

But this expression returned text:

mautrix_linkedin=# select pg_typeof('["linkedin:' || li_member_urn || '"]') from puppet;
 pg_typeof
-----------
 text

The `ghost.identifiers` column has the type `jsonb`,
but this expression retuned `text`, resulting in the following error on migration:
```
"pq: column \"identifiers\" is of type jsonb but expression is of type text"
```
Copy link
Member

@tulir tulir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't compatible with sqlite. Has to be more like https://github.com/mautrix/whatsapp/blob/main/cmd/mautrix-whatsapp/legacymigrate.sql#L93-L99, I think it's json_array in sqlite and jsonb_build_array in postgres

@Abestanis
Copy link
Contributor Author

Oh, sorry, I didn't realize that this was used for sqlite too, my bad! I'll see if I can fix that.

@Abestanis
Copy link
Contributor Author

Thanks for pointing me in the right direction. I verified that the postgres function does what we want here. I don't have the sqlite database to test the sqlite equivalent, but from the docs it looks like it should work.

I'm not familiar with the templating format you are using here to support both postgres and sqlite, so I just copied the example you provided, I hope it's ok like that.

@Abestanis Abestanis requested a review from tulir May 8, 2025 12:17
@Abestanis
Copy link
Contributor Author

Can I help getting this merged in any way?

@Abestanis
Copy link
Contributor Author

@tulir I had to adjust a couple other parts of the script to make it work with postgres, but this last version was able to finish the migration. I no longer need this myself since the db has been migrated, but I would still like to see this merged so others could migrate as well. Please let me know if there is anything I can do to help move this along.

@tulir tulir merged commit 1eafae5 into mautrix:main Sep 17, 2025
4 checks passed
@Abestanis
Copy link
Contributor Author

Thank you! 🎉

@Abestanis Abestanis deleted the patch-1 branch September 17, 2025 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants