View and analyze database schema structure using the Akron CLI across SQLite, MySQL, PostgreSQL, and MongoDB.
The inspect-schema
command provides detailed information about your database structure, including tables, columns, data types, constraints, and indexes. Essential for understanding existing databases and planning migrations.
akron inspect-schema --db <database_url> [options]
Type: str (required)
Database connection URL to inspect.
Type: str (optional)
Inspect specific table only instead of entire database.
Type: flag (optional)
Show only table names without column details.
Type: str (optional)
Output format: "table", "json", or "yaml". Default: "table"
Database Schema: myapp.db ================================ Table: users +------------+----------+---------+------------+ | Column | Type | Null | Default | +------------+----------+---------+------------+ | id | INTEGER | NO | NULL | | username | TEXT | NO | NULL | | email | TEXT | YES | NULL | | created_at | DATETIME | YES | CURRENT_TS | +------------+----------+---------+------------+ Table: posts +------------+----------+---------+------------+ | Column | Type | Null | Default | +------------+----------+---------+------------+ | id | INTEGER | NO | NULL | | user_id | INTEGER | NO | NULL | | title | TEXT | NO | NULL | | content | TEXT | YES | NULL | +------------+----------+---------+------------+ Total Tables: 2
Table: products +---------------+---------------+---------+-------------+ | Column | Type | Null | Default | +---------------+---------------+---------+-------------+ | id | INT | NO | AUTO_INC | | sku | VARCHAR(50) | NO | NULL | | name | VARCHAR(255) | NO | NULL | | description | TEXT | YES | NULL | | price | DECIMAL(10,2) | NO | 0.00 | | category_id | INT | YES | NULL | | in_stock | BOOLEAN | NO | TRUE | | created_at | TIMESTAMP | NO | CURRENT_TS | +---------------+---------------+---------+-------------+ Indexes: - PRIMARY KEY (id) - UNIQUE KEY sku_unique (sku) - KEY category_idx (category_id) Foreign Keys: - category_id → categories(id)
Tables in database 'app': - users - posts - comments - categories - tags - post_tags Total: 6 tables
{ "database": "social", "collections": [ { "name": "users", "schema": { "_id": "ObjectId", "username": "String", "email": "String", "profile": "Object", "created_at": "Date" }, "indexes": ["_id_", "username_1", "email_1"] }, { "name": "posts", "schema": { "_id": "ObjectId", "user_id": "ObjectId", "content": "String", "likes": "Array", "created_at": "Date" }, "indexes": ["_id_", "user_id_1"] } ] }
Shows: column types, constraints, default values, primary keys
Shows: indexes, foreign keys, constraints, auto-increment settings
Shows: inferred schema from documents, data types, nested structures