Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom CREATE DATABASE statements #214

Open
1 of 6 tasks
FelixZY opened this issue May 24, 2024 · 2 comments
Open
1 of 6 tasks

Support custom CREATE DATABASE statements #214

FelixZY opened this issue May 24, 2024 · 2 comments

Comments

@FelixZY
Copy link
Contributor

FelixZY commented May 24, 2024

Feature description

I'm developing an application which is highly sweden-centric. For this reason, I use the following setup:

CREATE DATABASE
  dansdata
WITH
  ENCODING 'UTF8'
  LOCALE_PROVIDER icu
  ICU_LOCALE "sv-SE"
  TEMPLATE template0;

However, these settings are not respected when the database is recreated by graphile-migrate.

Motivating example

I think it is important that migrations etc. are tested as close to production settings as possible.

Supporting development

I [tick all that apply]:

  • am interested in building this feature myself
  • am interested in collaborating on building this feature
  • am willing to help testing this feature before it's released
  • am willing to write a test-driven test suite for this feature (before it exists)
  • am a Graphile sponsor ❤️
  • have an active support or consultancy contract with Graphile
@FelixZY
Copy link
Contributor Author

FelixZY commented May 24, 2024

Additional use case:

CREATE EXTENSION IF NOT EXISTS "postgis"

requires superuser, which my graphile user does not have. I can work around this by granting the graphile user superuser, but then what's the difference to ROOT_DATABASE_URL?. It would be better if I could define a custom init script to be run by the root user (ROOT_DATABASE_URL).

@benjie
Copy link
Member

benjie commented May 25, 2024

For the latter question, please see the root option in action configuration, you are effectively asking for root afterReset commands. This will also let you ALTER DATABASE which may address some of your CREATE DATABASE concerns too.

https://github.com/graphile/migrate?tab=readme-ov-file#sql-action-spec

It’s unlikely I will work on this feature this year, so if it’s one you need you will need to be the one implementing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants