Skip to main content

Table Structure

Browse columns, indexes, foreign keys, and DDL for any table. Edit structure visually or with SQL.
Table Structure
Click a table in the sidebar, then click the Structure tab. Or right-click a table > Show Structure.

Columns Tab

Columns tab
PropertyDescription
NameColumn name
TypeData type (VARCHAR, INT, etc.)
NullableWhether NULL values are allowed
DefaultDefault value if none specified
ExtraAdditional attributes (AUTO_INCREMENT, etc.)
KeyPrimary key (PRI), Foreign key (FOR), etc.

Indexes Tab

Indexes tab
PropertyDescription
NameIndex name
ColumnsColumns included in the index
TypeBTREE, HASH, FULLTEXT, etc.
UniqueWhether the index enforces uniqueness
PrimaryWhether this is the primary key

Foreign Keys Tab

Foreign Keys tab
PropertyDescription
NameConstraint name
ColumnLocal column(s)
ReferencesTarget table and column
On DeleteAction when referenced row is deleted
On UpdateAction when referenced row is updated

DDL Tab

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

  1. Open Structure > Columns, click +
  2. Set properties: name, type, nullable, default, auto-increment, comment
  3. 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.
  4. Click Apply to preview and execute
Adding a new column in Structure editor

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.
Type picker popover

Schema Change Preview

Before applying, TablePro shows the generated ALTER TABLE SQL for review.
Schema change preview with ALTER TABLE statements
Cmd+Z to undo, Cmd+Shift+Z to redo structure changes before applying.
Undo and redo for structure changes

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.