actionhero / ah-sequelize-plugin

sequelize plugin for actionhero
36 stars 23 forks source link

How to use the "InjectedQueryInterface" #488

Closed nholmes3 closed 2 years ago

nholmes3 commented 2 years ago

Hello,

I am currently working with an open source package called Grouparoo that uses the ah-sequelize-plugin. Grouparoo includes a src/config/sequelize.ts file for Sequelize as per your documentation.

Grouparoo uses a Postgres database for its operations and therefore it attempts to provide the ability to pass a non "public" schema as a configuration option. However, when I provide a value that isn't "public" for the schema, one of the migrations in the Grouparoo project fails because the "addColumn" function in Sequelize is known to be problematic with custom schemas.

It appears that the "ah-sequelize-plugin" tries to solve for that problem by providing a getInjectedQueryInterface function that patches the problematic Sequelize functions.

I have included some custom logging in the compiled files of my project to determine whether or not the getInjectedQueryInterface function ever gets called when the Grouparoo process runs, and I have confirmed that it does not get called. I cannot find any documentation for how to actually make use of the patched QueryInterface. Your documentation alludes to this problem and the attempt at solving it, but does not actually provide instructions for how to use the solution correctly. Any guidance that you can provide would be greatly appreciated.

Thank you and please let me know if I can provide any additional information!

evantahler commented 2 years ago

Hi @nholmes3!

It looks like we haven't used that code in some time - it stopped being used here (https://github.com/actionhero/ah-sequelize-plugin/pull/414). It looks like Umzug changed the method signature drastically at that time. I'm going to remove that code to prevent any confusion.

Can you still reproduce the schema migration problem with just actionhero and ah-sequelize-plugin? If you can, we can figure out how to patch it here.

evantahler commented 2 years ago

unused code removed via https://github.com/actionhero/ah-sequelize-plugin/pull/489

evantahler commented 2 years ago

Here's a more specific issue. https://github.com/actionhero/ah-sequelize-plugin/issues/490. Chime in here if you have any ideas, or can link any docs from Sequelize

nholmes3 commented 2 years ago

Hey @evantahler thanks for getting back to me here. I will add my findings to #490