Closed WammKD closed 2 years ago
Hey so we shouldn't have Pointers as a dependency for apps wanting to use this library, I pushed a commit trying to make optional, can you let me know if that helps? https://github.com/bonfire-networks/activity_pub/commit/420791b3bd9df365d3ee74d3e2d8d49ff7c84ee6
Awesome; much better.
Tangentially, but not directly, related: is there an easy way to determine what database adapter someone might be using? There're some things that'll have to be done one way for one but another for the other (e.g. MySQL has support for inline JSON functions like PostgreSQL (->
, ->>
) but MariaDB, while planned, does not yet; however, MariaDB has spelled out functions which are the equivalent so the operation can still be done, at least).
If there isn't an easy means, do you have a preference for how it'd be done? I'd imagine a config. setting but just want to double check.
Cool :) Seems the __adapter__/0
function on the Repo module should do it?
Perfect! I feel like I've definitely seen that, somewhere, but I couldn't seem to find a good search engine answer, for the life of me. Just what I need.
I started with checking that database operations could work and where the library might need to do something different for MySQL/MariaDB.
On the good news side, not only do both of them have JSON support these days but MyXQL supports it; first thing I noticed is that the creation of the JSON column (
add(:data, :map)
) actually matches the instructions from MyXQL (see https://hexdocs.pm/ecto_sql/Ecto.Adapters.MyXQL.html#module-json-support). So I'm hoping there won't be much we'll have to change in that department and MyXQL will try to mimic whatever form Postgrex is using.The bad news came pretty quickly after, though.
Right now, the database is tripping up over the foreign keys attempted with
add(:pointer_id, weak_pointer())
. Per the logs, the tablepointers_pointer
isn't in the data dictionary.Is this a table that's normally already present in Postgres? I was looking over your Pointers library and, at least in glancing over the doc.s, it seemed like the
pointers_pointer
table would be something that'd be created by the library for the purpose of the functionality that the Pointers library provides.