Indico vs indico_template DBs

Sorry if this questions was already asked, but was is the difference between the indico and indico_template DBs? What’s the structure of each of the two and what do they contain, in general?

Thanks!

indico_template is just for convenience during development. It’s an empty DB with the pg_trgm and unaccent Postgres extensions enabled.

Since only a Postgres superuser can enable extensions, this allows you to recreate a new DB for Indico using createdb -T indico_template newdbname as a normal DB user. And even if your normal user is a superuser (which can be convenient during development), it still saves you the work of creating the two extensions since a copy of the template DB already has them.

I guess I don’t know enough about PostgreSQL to grasp why you would need that at all? I thought all Indico related development that results in any DB changes are taken care of through SQLAlchemy’s migration engine? :frowning:

Like I said, creating the postgres extensions requires superuser access - something the indico user does not (well, should not) have in any production setup. This is why the production setup guides have this step:

su - postgres -c 'psql indico -c "CREATE EXTENSION unaccent; CREATE EXTENSION pg_trgm;"'

The postgres user is the Postgres equivalent to root. In the dev setup guide we create the extension using the postgres user as well, and once that’s done in the template DB, your normal postgres user can create the normal indico db containing them:

sudo -u postgres psql indico_template -c "CREATE EXTENSION unaccent; CREATE EXTENSION pg_trgm;"
createdb indico -T indico_template

So I should not worry about any of that if all I want to do is create a new plugin (that’ll likely require the addition of a new table in the Indico DB), correct?

Correct. For the plugin table simply define a model in the plugin and autogenerate a migration step.

Got it. As always - thank you, @ThiefMaster!