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 |
| Extra | Additional attributes (AUTO_INCREMENT, etc.) |
| Key | Primary key (PRI), Foreign key (FOR), etc. |
Indexes Tab
| Property | Description |
|---|
| Name | Index name |
| Columns | Columns included in the index |
| Type | BTREE, HASH, FULLTEXT, etc. |
| Unique | Whether the index enforces uniqueness |
| Primary | Whether this is the primary key |
Foreign Keys Tab
| Property | Description |
|---|
| Name | Constraint name |
| Column | Local column(s) |
| References | Target table and column |
| On Delete | Action when referenced row is deleted |
| On Update | Action when referenced row is updated |
DDL Tab
Select all with Cmd+A and copy with Cmd+C. Useful for recreating tables, documenting schemas, or version control.
Modifying Structure
Structure modifications alter your database schema. Always backup important data before making changes.
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.
Schema Change Preview
Before applying, TablePro shows the generated ALTER TABLE SQL for review.
Cmd+Z to undo, Cmd+Shift+Z to redo structure changes before applying.
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.
Adding Columns via SQL
-- MySQL
ALTER TABLE users ADD COLUMN phone VARCHAR(20) AFTER email;
-- PostgreSQL
ALTER TABLE users ADD COLUMN phone VARCHAR(20);
-- SQLite (limited ALTER TABLE)
ALTER TABLE users ADD COLUMN phone TEXT;
Modifying Columns via SQL
-- MySQL
ALTER TABLE users MODIFY COLUMN name VARCHAR(200) NOT NULL;
-- PostgreSQL
ALTER TABLE users ALTER COLUMN name TYPE VARCHAR(200);
ALTER TABLE users ALTER COLUMN name SET NOT NULL;
-- SQLite (requires table recreation)
-- See SQLite documentation for workarounds
Dropping Columns via SQL
-- MySQL/PostgreSQL
ALTER TABLE users DROP COLUMN phone;
-- SQLite (requires table recreation)
Managing Indexes
-- Create index
CREATE INDEX idx_users_email ON users(email);
-- Create unique index
CREATE UNIQUE INDEX idx_users_username ON users(username);
-- Drop index
DROP INDEX idx_users_email ON users; -- MySQL
DROP INDEX idx_users_email; -- PostgreSQL
Managing Foreign Keys
-- Add foreign key
ALTER TABLE orders
ADD CONSTRAINT fk_orders_user
FOREIGN KEY (user_id) REFERENCES users(id)
ON DELETE CASCADE;
-- Drop foreign key
ALTER TABLE orders DROP FOREIGN KEY fk_orders_user; -- MySQL
ALTER TABLE orders DROP CONSTRAINT fk_orders_user; -- PostgreSQL
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.