cli-database-operations
Skill1 starsChanged 3 months agoMITView on GitHub
Use when running database migrations, seeding data, backing up, or inspecting the database schema in a Lexigram project
In this repository17 other files it gives its agents.
- ai-subsystem-quickstartSkill
- auth-and-securitySkill
- caching-patternsSkill
- cli-code-generationSkill
- cli-config-and-inspectSkill
- cli-project-scaffoldingSkill
- configuration-managementSkill
- creating-providers-and-modulesSkill
- database-repository-patternSkill
- events-and-messagingSkill
- lexigram-uiSkill
- multimedia-generationSkill
- real-time-webSkill
- resilience-patternsSkill
- testing-with-lexigramSkill
- using-result-and-error-codesSkill
- web-controllers-and-routingSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 65
Default URL is sqlite:///data.db.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLI Database Operations
Overview
lexigram db manages the full database lifecycle — migrations, seeding, schema inspection, and backup/restore — backed by lexigram-sql's migration manager. All commands accept --env/-e to select the environment.
Migration Lifecycle
lexigram db init # Create migrations/ directory (arg: dir name)
lexigram db migrate add_users_table # Generate a new migration file
lexigram db create add_users_table # New empty migration (-m for description)
lexigram db upgrade # Apply pending migrations
lexigram db downgrade # Roll back the most recent
lexigram db downgrade 0003_seed # Roll back to a specific version (positional arg)
lexigram db status # Current version + pending
lexigram db history --limit 20 # Last N applied migrations (-n)
lexigram db validate # Check applied migrations have filesSeeding & Reset
lexigram db seed # Run seeds/*.py scripts (arg: single file)
lexigram db reset --seed # Drop + recreate + seed
lexigram db reset --force # Skip confirmation promptSeed scripts live in seeds/*.py.
Inspection & Administration
lexigram db inspect # List tables
lexigram db inspect --table users # One table's columns + types (-t)
lexigram db shell # Open a DB client REPL
lexigram db setup # Per-package schema setupBackup & Restore
lexigram db backup --output dump.sql
lexigram db restore dump.sql --forceConfig
The SQL config section is sql: (env prefix LEX_SQL__):
sql:
backend:
url: postgresql+asyncpg://user:pass@localhost:5432/mydb
pool:
min_size: 2
max_size: 10Default URL is sqlite:///data.db. Valid URL schemes: sqlite, postgresql/postgres, mysql, mariadb, oracle, mssql. Insecure default credentials are blocked in production.
Common Mistakes
- Running
upgradebeforedb init— the migrations directory must exist - Running
downgradewithout a version argument — reverts only the most recent - Editing applied migration files — write a new migration instead
reset --forcewithout backup — irreversible data loss- Using sync driver (psycopg2) in async context — use
+asyncpgin the URL
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

