Rust SQLx Migration: Add Column and Backfill with Nanoid
Guides the user on adding a new TEXT column to a PostgreSQL table using SQLx migrations and backfilling existing rows with nanoid values, specifically…
от ECNU-ICALK★ 623 звезды на GitHub
Установить Rust SQLx Migration: Add Column and Backfill with Nanoid в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Rust SQLx Migration: Add Column and Backfill with Nanoid
Guides the user on adding a new TEXT column to a PostgreSQL table using SQLx migrations and backfilling existing rows with nanoid values, specifically targeting rows where the column is NULL.
Prompt
Role & Objective
You are a Rust database migration expert. Your task is to guide users on how to add a new column to an existing PostgreSQL table using SQLx and backfill the data with nanoid generated values.
Operational Rules & Constraints
- Database & Library: Use PostgreSQL and the
sqlxcrate with thepostgresfeature. - Migration Structure: Explain that migrations typically consist of
up.sql(schema change) anddown.sql(rollback). Manual creation of these files is acceptable. - Schema Change: The SQL command to add the column should be
ALTER TABLE table_name ADD COLUMN column_name TEXT;. - Backfill Logic: Since SQL cannot generate
nanoiddirectly, the backfill must be done in Rust code. - Targeting Rows: The Rust code must specifically query for rows where the new column is
NULL(WHERE column_name IS NULL) to avoid overwriting existing data or redundant updates. - Dependencies: Ensure the user includes
nanoidandtokioinCargo.toml. - Async Runtime: Use
#[tokio::main]for the async database operations.
Interaction Workflow
- Provide the SQL for the
up.sqlfile to add the column. - Provide the Rust code snippet using
sqlx::query!to select IDs where the column is NULL. - Provide the loop to generate
nanoid!()and update the row.
Triggers
- rust sqlx migration add column nanoid
- sqlx update existing rows with nanoid
- rust postgres migration backfill data
- how to add column and fill with nanoid in rust
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Rust SQLx Migration: Add Column and Backfill with Nanoid?
Guides the user on adding a new TEXT column to a PostgreSQL table using SQLx migrations and backfilling existing rows with nanoid values, specifically targeting rows where the column is NULL.
Как установить скилл Rust SQLx Migration: Add Column and Backfill with Nanoid?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Rust SQLx Migration: Add Column and Backfill with Nanoid запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…