本文へ移動
cccskills
無料GitHub で公開日本語紹介

datatables

Windmillのデータテーブルでスキーマ変更をマイグレーションとして管理し、適用・ロールバックする方法や、ロールに基づく権限の扱いを案内します。

原文原文の説明を見る

MUST use when changing a data table's schema, writing or running its migrations, or working with its roles and permissions.

windmill-labs/windmillスター 18,280(GitHub 18,280 + cccskills 0)
連携ツールPostgreSQL

実行スコア 未検証

インストール方法を見る

こんなときに便利

  • データテーブルのスキーマを変更したいとき
  • SQLマイグレーションを適用したいとき
  • 適用済み変更をロールバックしたいとき
  • テーブルのロール権限を確認したいとき

日本語での紹介

できること

Windmillのデータテーブルに対するスキーマ変更、SQLマイグレーション、ロールと権限の扱いを案内します。マイグレーションが有効なテーブルでは、変更を順序付きの履歴として追加し、必要に応じて元に戻すdownも用意します。適用済みのマイグレーションを直接編集しないこと、トランザクションや対象スキーマの宣言を使うこと、wmill datatable migrate各コマンドで作成・適用・状態確認する方法を説明します。変更が既存データベースへ及ぼす影響や、ワークスペースのフォークを使った検証方法、ロールに応じた権限不足の調べ方も扱います。

こんなときに便利

データテーブルの列やテーブルを変更する場合、マイグレーションを新規作成して適用・ロールバックしたい場合に役立ちます。スクリプトやアプリが使うテーブルへの影響を整理したいときや、特定のロールに必要な権限を確認するときにも参照できます。

使い方の例

  • 「このデータテーブルに列を追加するマイグレーションを作ってください」
  • 「保留中のマイグレーションを確認して適用してください」
  • 「このpermission deniedがどのロールの権限不足か調べてください」

注意点

データテーブルはWindmillのワークスペース設定で管理されます。ロール機能はセルフホストのEnterprise Edition向けで、Postgresリソースを使うテーブルでは利用できません。マイグレーションの適用はデータベースを変更します。

この紹介文は、公開されている SKILL.md をもとに AI(OpenAI Codex)が作成しました。正確な仕様は下の原文を確認してください。

含まれるファイル(1)

  • SKILL.md5.2 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Data tables: schema changes, migrations and permissions

A data table is a PostgreSQL database managed by Windmill and shared by the whole workspace: scripts, flows and apps reach it by name, main being the default. It is configured in the workspace settings (Data Tables), never created by SQL.

Changing the schema

A data table with migrations enabled keeps its schema as an ordered list of versioned SQL migrations, each an up and an optional down. That list is what git sync and a workspace merge carry, and what rebuilds the schema in another workspace. So first find out whether migrations are enabled on the data table:

  • Enabled: make every schema change (CREATE, ALTER, DROP, anything but row data) as a new migration. A change made with plain SQL exists in that one database only, and the history no longer describes it.
  • Not enabled: schema changes are plain SQL. Enabling migrations is a workspace admin's decision, made in the Data Tables settings, not a step to take on the way to something else.

Writing a migration:

  • Wrap the statements in BEGIN; ... END; so it applies atomically. Leave the frame out only for a statement that cannot run in a transaction, such as CREATE INDEX CONCURRENTLY: such a migration can fail half applied.
  • Give it a down that undoes the up whenever the change is reversible. Without one it cannot be rolled back.
  • Declare the schemas it changes on a leading line of its up, -- schemas sales, billing, and qualify every name with its schema (sales.orders). A migration waits only on earlier migrations whose schemas overlap its own. One that declares none applies to the whole database and every later migration waits for it, so leave the line out only for a change that really spans the database, such as an extension.
  • Migrations apply oldest first. One that is applied is not edited: correct it with a new migration.
  • Row data is not schema. Insert, update and delete rows with plain SQL, migrations or not.

wmill datatable migrate new <name> scaffolds migrations/datatable/<datatable>/<timestamp>_<name>.up.sql and .down.sql, wmill datatable migrate up pushes the local files and applies what is pending, wmill datatable migrate down rolls back the most recent one and wmill datatable migrate status lists them. All take -d <datatable> and default to main. migrate new --schemas sales,billing writes the -- schemas line, and migrate up --schema sales applies only the pending migrations declaring that schema.

A migration is not a draft

A migration is saved to the workspace and changes the database as soon as it is applied, for everything that reads those tables. To try a schema out without touching tables already in use:

  • put the new tables in a schema of their own, created by the same migration (CREATE SCHEMA IF NOT EXISTS), and point what you are building at it. A raw app names its schema in its data config, which is why a new app gets a new schema by default;
  • or work in a workspace fork whose data table was cloned when the fork was created ("Clone schema only" or "Clone schema and data"): migrations applied there change that copy alone, and reach the parent workspace when the fork is merged. A fork that kept the original data table points at the parent's database, so a migration applied in it changes the parent's tables at once.

Altering or dropping a table other scripts or apps use is neither of those: say what depends on it before doing it.

Roles and permissions

Data table roles are a self-hosted Enterprise Edition feature, for data tables on managed Postgres (the instance database or the external managed instance). Without them, and always on a data table backed by a Postgres resource, everyone who can use the data table reaches all of it: there is no per-user, per-schema or per-row access to promise.

A data table under roles is reached as a Postgres role, and Postgres enforces what that role was granted:

  • roles are assigned, per data table, to users, groups or folders. admin is the connection the data table had before roles: it owns the existing objects and ignores grants;
  • a connection either names a role (wmill.datatable('main', { role: 'analyst' }), role='analyst' in Python, datatable://main?role=analyst) and holds that role alone, or names none and is resolved from the data table's default role;
  • permission denied means the role in use lacks a grant. Say which role and which object: the grant is a data table admin's to give, in the roles drawer of the Database Manager. Do not switch to admin to get past it;
  • a migration runs as the role its SQL declares on its first line, -- role <name>, the same one in its down. One that declares none runs as admin, which only those who may use admin can do.

Read the Permissions section of https://www.windmill.dev/docs/core_concepts/persistent_storage/data_tables before designing who reaches what: it covers tenants, grants, the default role and the roles a connection that names none ends up holding, rows that differ per viewer through row-level security, and how forks and raw apps behave under roles.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

adding-a-trigger

無料概要あり

Windmillに新しいTriggerCrud型のトリガーを追加する際、バックエンドからCLI、画面、同期やキャプチャ機能まで必要な変更箇所を確認できる開発チェックリストです。

  • 新しい外部サービスのトリガーを追加したいとき
  • 実装箇所の抜け漏れを点検したいとき
  • トリガー追加のPR前に検証したいとき
windmill-labs/windmill1.8万2026年10月26日 更新

ai-chat

無料概要あり

WindmillのAIチャットを変更するときに、ツールやプロンプト、結果の返し方、コンテキスト量を整理し、評価で変更前後の挙動を比べるための指針です。

  • チャットツールを変更したいとき
  • プロンプトの配置を見直したいとき
  • コンテキスト消費を抑えたいとき
windmill-labs/windmill1.8万2026年10月26日 更新

ai-evals

無料概要あり

WindmillのAI生成モード向けに、実際の利用要求に沿ったベンチマークケースを作成・実行します。生成結果を決定的な検証とLLM評価で確認し、AIチャットやcopilotの変更前後を比較できます。

  • AI生成モードの評価ケースを追加したいとき
  • AIチャットの変更前後を比較したいとき
  • copilotの生成品質を確認したいとき
windmill-labs/windmill1.8万2026年10月26日 更新

cli-commands

無料概要あり

Windmill CLIのコマンドを使い、スクリプトやフローなどの管理、ジョブの実行履歴確認、失敗原因の調査を進めるためのリファレンスです。

  • 失敗したジョブの原因を調べたいとき
  • 実行履歴やジョブログを確認したいとき
  • CLIでスクリプトやフローを管理したいとき
windmill-labs/windmill1.8万2026年10月26日 更新

codebase-design

無料概要あり

モジュールのインターフェースを小さく保ちながら、内部に複雑な処理をまとめる設計を支援します。テストしやすさや変更のしやすさを考え、処理の境目を整理できます。

  • モジュールのインターフェースを設計したいとき
  • 既存モジュールの複雑さを整理したいとき
  • 処理を差し替える境目を決めたいとき
windmill-labs/windmill1.8万2026年10月26日 更新

commit

無料概要あり

変更内容を確認し、対象ファイルだけを選んで、形式や長さの規則に沿ったConventional Commits形式のGitコミットを作成するスキルです。

  • 機能追加をコミットしたいとき
  • バグ修正を記録したいとき
  • 変更内容に合うコミット文を作りたいとき
windmill-labs/windmill1.8万2026年10月26日 更新

windmill-labs のスキルをすべて見る

このスキルの問題を報告する