Table Structure
Browse columns, indexes, foreign keys, and DDL for any table. Edit structure visually or with SQL.
Click a table in the sidebar, then click the Structure tab. Or right-click a table > Show Structure.
Columns Tab
| Property | Description |
|---|
| Name | Column name |
| Type | Data type (VARCHAR, INT, etc.) |
| Nullable | Whether NULL values are allowed |
| Default | Default value if none specified |
| Primary Key | Whether the column is part of the primary key |
| Auto Inc | AUTO_INCREMENT / SERIAL |
| Comment | Column comment |
| Charset | Character set (MySQL/MariaDB only) |
| Collation | Collation (MySQL/MariaDB only) |
Use the filter field at the top to search columns by name. Click any column header to sort.
Indexes Tab
| Property | Description |
|---|
| Name | Index name |
| Columns | Columns included in the index. MySQL prefix lengths shown as col(10) |
| Type | BTREE, HASH, FULLTEXT, GIN, GIST, BRIN, etc. |
| Unique | Whether the index enforces uniqueness |
| Condition | WHERE clause for partial indexes (PostgreSQL) |
Add and Drop Indexes
Click + to add a new index, - or Delete to mark an index for removal. Multi-column indexes are supported by adding multiple column entries to one index row.
- Partial indexes (PostgreSQL): enter a
WHERE predicate in the Condition field. The generated DDL emits CREATE INDEX ... WHERE ....
- Prefix length (MySQL/MariaDB): append
(N) to the column entry, for example email(20). Useful for TEXT and long VARCHAR columns.
- Index type: pick from the type dropdown. Available types depend on the database (BTREE everywhere, GIN/GIST/BRIN on PostgreSQL, FULLTEXT/SPATIAL on MySQL).
Changes are queued. Click Apply to preview the CREATE INDEX / DROP INDEX statements before executing.
Foreign Keys Tab
| Property | Description |
|---|
| Name | Constraint name |
| Columns | Local column(s) |
| Ref Table | Referenced table |
| Ref Columns | Referenced column(s) |
| Ref Schema | Referenced schema (for cross-schema references) |
| On Delete | Action when referenced row is deleted (NO ACTION, CASCADE, SET NULL, SET DEFAULT, RESTRICT) |
| On Update | Action when referenced row is updated |
On Delete and On Update use dropdown pickers with all standard referential actions.
Add and Drop Foreign Keys
Click + to add a new foreign key, - or Delete to remove one. The local and referenced columns use dropdowns populated from the live schema, so typos surface as missing entries rather than runtime errors.
- Cross-schema references: pick a different schema in the Ref Schema column for PostgreSQL or MySQL. The generated DDL qualifies the referenced table (
other_schema.other_table).
- Composite foreign keys: add multiple column pairs to a single FK entry.
- Referential actions: configure
ON DELETE and ON UPDATE per FK.
Changes are queued. Apply to preview the generated ALTER TABLE ... ADD CONSTRAINT / DROP CONSTRAINT SQL.
Primary Keys
Mark one or more columns as primary key in the Columns tab by toggling the Primary Key flag. Multiple flagged columns produce a composite primary key. The generated DDL emits a single PRIMARY KEY (col1, col2) clause.
Changing a primary key on an existing table executes as a drop-and-add sequence. SQLite and ClickHouse do not support modifying primary keys without recreating the table: TablePro disables the action on those databases.
Table Options (MySQL/MariaDB)
The Columns tab toolbar exposes table-level Charset and Collation pickers for MySQL and MariaDB. Changes generate ALTER TABLE ... CONVERT TO CHARACTER SET ... and update the table’s default collation. Per-column overrides remain available in the column detail panel.
DDL Tab
The DDL view uses tree-sitter syntax highlighting with line numbers. Use the toolbar buttons to:
- Copy the DDL to clipboard
- Export as a
.sql file
- Open in Editor to send the DDL to a new query tab for editing
Creating a New Table
Right-click in the sidebar and select Create New Table…. A visual editor opens with:
- Table Name field and database-specific options (Engine, Charset, Collation for MySQL/MariaDB)
- Columns tab - define columns with name, type, nullable, default, primary key, auto increment, and comment
- Indexes tab - add indexes with type (BTREE, HASH, FULLTEXT, SPATIAL) and uniqueness
- Foreign Keys tab - define relationships with referenced tables, ON DELETE/ON UPDATE actions
- SQL Preview tab - live-generated CREATE TABLE DDL with syntax highlighting
Click Create Table (or Cmd+Return) to execute. The new table appears in the sidebar immediately.
Supported databases: MySQL, MariaDB, PostgreSQL, SQLite, SQL Server, ClickHouse, and DuckDB. Each generates database-specific DDL syntax.
Modifying Structure
Structure modifications alter your database schema. Always backup important data before making changes.
Database Support
Not all databases support every ALTER TABLE operation. TablePro disables unsupported actions in the UI.
| Operation | MySQL / MariaDB | PostgreSQL | SQLite | ClickHouse | SQL Server | DuckDB | Oracle |
|---|
| Add column | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Modify column | Yes | Yes | Rename only | Yes | Yes | Yes | Yes |
| Drop column | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Add / drop index | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Add / drop FK | Yes | Yes | - | - | Yes | Yes | Yes |
| Modify PK | Yes | Yes | - | - | Yes | Yes | Yes |
| Reorder columns | Yes | - | - | - | - | - | - |
Cassandra supports add and drop column only. MongoDB structure is read-only. Redis, Etcd, and DynamoDB do not have table schemas.
Visual Structure Editor
Adding Columns
- Open Structure > Columns, click +
- Set properties: name, type, nullable, default, auto-increment, comment
- Click the Type cell to open the type picker. Browse by category or search. For parametric types (
VARCHAR(255), DECIMAL(10,2)), type directly in the freeform field.
- Click Apply to preview and execute
Modifying Columns
Click a column, edit properties in the detail panel, then Apply to preview the ALTER TABLE SQL. Changes support undo/redo.
Removing Columns
Select the column, click - or press Delete, confirm, then apply.
Right-click any row in the Columns, Indexes, or Foreign Keys tabs:
| Action | Description |
|---|
| Copy Name | Copy the item name to clipboard |
| Copy Definition | Copy the SQL definition |
| Copy As | Copy as CSV, JSON, or SQL INSERT |
| Open [table] | (Foreign Keys tab) Navigate to the referenced table |
| Duplicate | Duplicate selected items |
| Delete | Mark items for deletion (apply to execute) |
Multi-select rows to copy or delete multiple items at once.
Schema Change Preview
Before applying, TablePro shows the generated ALTER TABLE SQL for review.
Destructive changes (dropping columns, changing data types) show a confirmation dialog before executing.
Cmd+Z to undo, Cmd+Shift+Z to redo structure changes before applying. Schema changes are recorded in query history.
Reordering Columns
Drag a column row up or down in the Columns tab to change its position. The reorder executes immediately as an ALTER TABLE ... MODIFY COLUMN ... AFTER statement.
Column reordering is only available for MySQL and MariaDB. Other databases do not support changing column order without recreating the table.
Drag is disabled when you have unsaved structure changes. Apply or discard pending changes first.
For changes unsupported by the visual editor, use the SQL editor directly.
Refreshing Structure
Right-click the table > Refresh, or use View > Refresh. Changes made in TablePro refresh automatically.
MongoDB Collections
The structure tab for MongoDB is read-only. TablePro infers the schema by sampling documents. Three columns are shown:
- Name: Field name (including nested paths with dot notation)
- Type: BSON type (ObjectId, String, Int32, Int64, Double, Boolean, Date, Array, Object, etc.)
- Nullable: Whether the field is present in all sampled documents
Indexes
MongoDB indexes are shown as createIndex() commands that can be copied and run in mongosh.
DDL Tab
Shows index definitions as db.collection.createIndex() statements, collection validators as db.runCommand({collMod: ...}), and collection options (capped, size, max) if applicable.
MongoDB is schema-less, so structure modification is not available. Edit documents directly in the data grid.