Aller au contenu
Skillpedia
Bases de données18k · #10629

datatables

Ce qu’il fait

Cette skill explique comment modifier le schéma d'une table de données Windmill, à l'aide de migrations ordonnées lorsqu'elles sont activées, et comment fonctionnent ses rôles et permissions. Elle s'adresse aux personnes qui gèrent une base de données partagée dans Windmill.

Quand l’utiliser

  • ✓Quand vous devez ajouter, modifier ou supprimer une colonne ou un autre élément du schéma d'une table Windmill.
  • ✓Lorsque les migrations sont activées et que vous devez écrire une migration montante avec sa migration descendante correspondante.
  • ✓Lorsque vous devez définir des rôles ou des permissions sur une table de données.

Lien du skill

https://github.com/windmill-labs/windmill/blob/main/system_prompts/auto-generated/skills/datatables/SKILL.md

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/windmill-labs/windmill/blob/main/system_prompts/auto-generated/skills/datatables/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Ajoute une nouvelle colonne à notre table de données clients dans Windmill, et assure-toi que la modification est suivie comme une migration.”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

La skill demande à votre agent d'enregistrer les modifications de schéma comme des migrations versionnées lorsqu'elles sont activées, afin que la modification suive l'espace de travail et puisse être annulée.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis 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 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 ta
Questions fréquentes

Pourquoi ne pas simplement exécuter du SQL classique ?

Avec les migrations activées, une modification SQL classique n'existe que dans une seule base, et l'historique des migrations ne correspond plus.

Qu'est-ce qu'une migration descendante ?

C'est l'étape qui annule une migration montante, pour que la modification puisse être inversée.

Qui décide si les migrations sont activées ?

Un administrateur de l'espace de travail le décide dans les paramètres des tables de données.

Détails

Description originale de l’auteur

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

Popularité

Étoiles GitHub
18k
Position au classement
#10629
Licence
—
Mis à jour
02/11/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires