By default, we create all Postgresql database tables as user postgres, which then owns them. This is a good idea because that way, the AppConfig's provisioned database user cannot acccidentally modify the schema of the database.
However, some application frameworks (like what's used by Mastodon), like to perform database migrations from scripts (like bundle exec rails db:migrate) that want to use the AppConfig's provisioned database user. Which they can't if the tables are owned by postgres.
Second problem: upon ubos-admin update, or during restore, the AppConfig's old provisioned database user does not exist upon restore.
Ergo: for those apps that need this, we need to change database table ownership (and perhaps the ownership of some other things, too) after restore of the database content, but before any migration scripts are run.
By default, we create all Postgresql database tables as user
postgres
, which then owns them. This is a good idea because that way, the AppConfig's provisioned database user cannot acccidentally modify the schema of the database.However, some application frameworks (like what's used by Mastodon), like to perform database migrations from scripts (like
bundle exec rails db:migrate
) that want to use the AppConfig's provisioned database user. Which they can't if the tables are owned bypostgres
.Second problem: upon
ubos-admin update
, or during restore, the AppConfig's old provisioned database user does not exist upon restore.Ergo: for those apps that need this, we need to change database table ownership (and perhaps the ownership of some other things, too) after restore of the database content, but before any migration scripts are run.