Create default roles on `reset` if they don't exist
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- postgresql, typescript
調査の方向性
まず、issue に記載されている reset フローと beforeReset および afterReset フックを追跡します。これには、作成前にデータベースの所有者がどのように選択されるかも含まれます。新しいデータベースが存在していなくても済むように、デフォルトロールとプレースホルダー値をどこに組み込めるかを判断します。reset が必要なロールを確実に初期化でき、初回セットアップと既存のロールの両方についてその動作がテストでカバーされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Feature description
It would be a great developer experience if the Owner and Authenticator roles could be created on reset if they don't already exist. The tool could create the roles automatically or allow developers to do so themselves in hooks.
If the tool handled it automatically, then it could take additional placeholder variables:
{
"placeholders": {
"DATABASE_AUTHENTICATOR": "!ENV",
"DATABASE_AUTHENTICATOR_PASSWORD": "!ENV",
"DATABASE_OWNER_PASSWORD": "!ENV"
// …
}
}
Motivating example
I'm initializing a database for the first time and trying to avoid writing a one-off setup_db.js script by hooking into the graphile-migrate event system.
I tried to create the default roles in an !afterReset.sql script like so:
BEGIN;
DO $$
BEGIN
CREATE ROLE :DATABASE_OWNER WITH LOGIN PASSWORD :DATABASE_OWNER_PASSWORD SUPERUSER;
EXCEPTION WHEN duplicate_object THEN RAISE NOTICE '%, skipping', SQLERRM USING ERRCODE = SQLSTATE;
END;
$$;
DO $$
BEGIN
CREATE ROLE :DATABASE_AUTHENTICATOR WITH LOGIN PASSWORD :DATABASE_AUTHENTICATOR_PASSWORD NOINHERIT;
EXCEPTION WHEN duplicate_object THEN RAISE NOTICE '%, skipping', SQLERRM USING ERRCODE = SQLSTATE;
END
$$;
…
However, this fails because graphile-migrate attempts to run the script as the Owner before the Owner is created:
graphile-migrate: dropped database 'my_database'
Error: Failed to create database 'my_database' with owner 'my_database_owner': role "my_database_owner" does not exist
I was surprised by the error because I expected graphile-migrate to connect as the root user.
Alternatively, I tried creating the default roles in a !beforeReset.sql script. However, this fails because the beforeReset hook expects the database to exist before it's been created:
error: database "my_database" does not exist
Creating these roles is something all graphile-migrate users have to do, so all of us could benefit from this feature 😄.
Breaking changes
I don't think so.
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
- 主要言語
- TypeScript
- スター
- 836
- フォーク
- 71
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
graphile/migrate のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
-
🐛 bug
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
graphile/migrate の issue をすべて見る
似ている issue
-
foreground-up-signals-live: delivery-repair cell expects a spawn suggestion status no longer printsオープンbug triage:owned
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
e2e-failure ready-to-code
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
redhat-developer/rhdh-plugin-export-overlays#4905 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
directus/directus#28558 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
review: medium
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
1lck/Lithe-IDEA#2432 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
cloudflare/workers-sdk#17189 ·
メンテナーはふだん 1 日以内に返信