Source code changes after plugin installation?

Likely a very newbie question, but…

When installing a Plugin inside a dev/prod env (via setup.py), where do they install and do any source code changes happen inside the src folder for Indico (especially if a DB table needs to be added)?

Thanks!

No, plugins are completely standalone. They do not modify any indico code. Installing a plugin installs the package in the python environment’s site-packages like any other package.

Plugin DB tables live in separate alembic namespaces (that’s also why a plugin may ONLY put tables in a plugin_xxx schema), so they are separate from the rest of Indico - but of course you could define a relationship to an existing indico model, and by adding a backref you’d expose your relationship on that particular model. This is quite convenient if you want to extend an existing model to store plugin-specific data.

Got it

Not knowledgeable enough yet to grasp this :frowning: Not sure what a backref is in this context. How does one define a relationship to an existing indico model for example? Now sure where to start in order to understand what you mean…

I think it’s easier if you explain what kind of plugin you want to write and we give you specific tips. That is much easier than explaining the general concepts (which in this case is actually more something related to SQLAlchemy, the database/orm library Indico uses).

PS: The vc_vidyo plugin uses such a table (VidyoExtension model) to store extra data related to a videoconference room. So you can have a look there to see roughly how it’s done.

I have to write an Invoices plugin, that pulls data for a specific registrant (for a Conference, Event, etc.) and then allows you to generate a Pro Forma (and later - regular) Invoice for the payment. I will then store this Invoice in a new Table row in order to be able to later refer to it, export it, search for it, etc.

I still think this belongs inside the even scope (ie a menu item in the event management sidemenu).

You’ll indeed need a table if you want to store data as it is at the moment the invoice is generated; but it should be pretty straightforward. To link an invoice to an event and registrant, add foreign keys + relationship pointing to the events and registrations tables (if ALL your invoices will be tied to a registrant, then no link to event is needed as each registrant is already tied to an event).