datatables
What it does
This skill explains how to change the schema of a Windmill data table, using ordered migrations when they are enabled, and how its roles and permissions work. It is for people who manage a shared database in Windmill.
When to use it
- ✓When you need to add, change or remove a column or other schema in a Windmill data table.
- ✓When migrations are enabled and you need to write an up migration with its matching down migration.
- ✓When you need to set roles or permissions on a data table.
Skill link
https://github.com/windmill-labs/windmill/blob/main/system_prompts/auto-generated/skills/datatables/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Add a new column to our customers data table in Windmill and make sure the change is tracked as a migration.”
5 new skills a week. 1 minute to read.
How it works
The skill tells your agent to record schema changes as versioned migrations when they are enabled, so the change moves with the workspace and can be undone.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
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 asCREATE INDEX CONCURRENTLY: such a migration can fail half applied. - Give it a
downthat undoes theupwhenever 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 itsdataconfig, 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.
adminis 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 deniedmeans the role in use lacks a grant. Say which role and which object: the grant is a data ta
FAQ
Why not just run plain SQL?
With migrations enabled, a plain SQL change exists in one database only, and the migration history no longer matches it.
What is a down migration?
It is the step that undoes an up migration, so the change can be reversed.
Who decides whether migrations are enabled?
A workspace admin decides this in the Data Tables settings.
Details
Original description by the author
MUST use when changing a data table's schema, writing or running its migrations, or working with its roles and permissions.
repo: windmill-labs/windmill
Popularity
- GitHub stars
- 18k
- Ranking position
- #10629
- License
- —
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
commit
18kHelps your agent write a clean one-line git commit message in conventional format, staging only the files that changed.
pr
18kHelps your agent open a draft pull request on GitHub with a clear title and description, then follow the review rounds.
agents
18kHelps your agent build a reusable Windmill AI agent with its own model, system prompt, tools and memory.
cli-commands
18kHelps your agent run the Windmill command line tool to manage scripts, flows, apps and job history.
Similar skills
discrawl
394kLets your agent search and summarize a saved local archive of Discord messages, check how fresh it is, and read direct messages.
clickhouse-io
280kHelps your agent optimize queries and schemas in ClickHouse databases. It applies best practices for high-performance analytical workloads. Use when analytical queries are too slow.
scientific-db-pubmed-database
280kHelps your agent search for scientific articles in the biomedical field. It's useful for research needing specific medical information.