Table Structure Editor
The table structure editor keeps single-table metadata and a change draft in a persistent tab. DBX enables only operations that the active database capability can generate reliably and shows the final DDL before save.
Open the Editor
- Right-click a table and choose View structure or Edit structure
- Open from a column node and focus that column
- Open from an index node and focus that index
- Open from table information in the data grid
- Open the same table from Object Browser or a DDL action
The editor retains the active tab, scroll position, column widths, and local column order while you move between structure and data.
Structure Tabs
| Tab | Main contents |
|---|---|
| Columns | Name, type, length/precision, nullability, default, primary key, identity, charset, collation, comment |
| Indexes | Name, columns, type, unique state, included columns, filter, comment, and rebuild action |
| Foreign keys | Local columns, target table/columns, ON DELETE, and ON UPDATE |
| Triggers | Trigger metadata, source, and supported create/edit/drop actions |
| DDL | Current table definition or driver-generated structure SQL |
When the database does not provide a metadata class, the related tab is hidden, read-only, or displays a capability explanation.
Column Editing
Depending on database capability, you can:
- Add a column or insert after the current selection
- Drop, rename, and alter columns
- Change type, length, precision, scale, and database-specific length units
- Change
NULL, default, primary key, identity, charset, collation, and comment - Use quick picks for common default values
- Drag columns to change order
Column reorder has two meanings:
- MySQL and other databases with physical column-order DDL generate a real reorder
- Some databases save only the local display order in DBX without changing physical structure
New-table creation can use preset fields from settings for common primary keys, timestamps, or audit columns.
Edit an Existing OceanBase Oracle Primary Key
Use the existing primary key's constraint card to edit or drop it in OceanBase Oracle. This operation supports ordinary tables with an enabled, validated, non-deferrable primary key. Its supporting index must be a valid, visible, non-partitioned normal unique index with the same column order and no other constraints sharing it.
- Choose Edit on the primary key's constraint card, select the target columns, and use Move up and Move down to set their order. Choose Delete to remove the entire key.
- Save other structure changes separately, then preview the primary key SQL. DBX checks the latest definition, supporting index, foreign-key references, and null or duplicate target values. References, including disabled foreign keys, incomplete metadata, and unsupported states prevent execution.
- Review the table, constraint name, and column order before saving. DBX checks the definition again before execution. If it changed, refresh and preview again.
- Review the execution result and reloaded structure. If a statement fails or its outcome is unknown, inspect the database before attempting another change.
When the original key was dropped and a subsequent read confirms that the table has no primary key, the result details include candidate SQL for manual recovery. Recheck the data, names, and indexes before running it. DBX never executes recovery automatically. This SQL restores only the original logical primary key, not physical properties such as tablespace, compression, or storage settings.
Edit an Existing Native Oracle Primary Key
Native Oracle uses the same constraint card, ordered column selection, preview, and save entry points. Replacement on ordinary tables preserves the original enabled, validated, deferrable, and initially deferred state, including meaningful RELY settings for unvalidated constraints. It does not automatically enable or validate the key. Target columns must still pass null and duplicate checks. External, index-organized, and temporary tables are excluded from this entry point.
Index columns may have a different order from the constraint, but must contain the same set of columns. Valid, visible, non-partitioned normal nonunique indexes are also supported; deferrable keys use nonunique indexes. A disabled key without an associated index is shown explicitly: DBX does not infer or delete a same-named independent index, or create an index for the replacement. Manual recovery candidates retain the original constraint state without automatically enabling a disabled key.
Choose Keep the original index or Drop the original index before saving. Keeping it is the default and preserves the old uniqueness rules. For example, changing a single-column key to a composite key does not remove the original column's uniqueness when its unique index is retained. Dropping the index loses its physical settings; preview identifies the affected index. A changed column set uses a new index name to avoid colliding with the retained index.
DBX blocks known references, and the database rejects references that are invisible or added concurrently. No cascade is used. The two DDL statements commit independently; after partial failure, inspect the actual key and index states. Manual recovery recommends reusing an old index only when its complete definition still matches. If a same-name index changed or its state is unknown, the candidate remains commented out for manual inspection. Native Oracle live-database acceptance is still pending; OceanBase results do not establish native Oracle acceptance.
Indexes, Foreign Keys, and Triggers
Index capabilities vary by dialect and can include:
- Create, drop, or rebuild an index
- Standard, unique, and database-specific index types
- Included columns or filters on PostgreSQL, SQL Server, and similar databases
- Index comments where supported
- Automatic names for new indexes with editable values
Native Oracle and OceanBase Oracle both provide foreign-key create, edit, and drop actions for existing and new tables. DBX reads and verifies an existing definition before enabling its editor. Incomplete or unreadable definitions remain read-only.
Composite foreign keys store each local and referenced column as an ordered pair. Moving a row moves both columns. ON DELETE supports NO ACTION, CASCADE, and SET NULL; Oracle does not expose ON UPDATE. Both databases expose enabled, validated, and RELY states. Deferrability is available only for native Oracle.
Save existing-table foreign-key changes separately from columns, primary keys, indexes, triggers, partitions, table comments, or handwritten DDL. A new-table plan can include columns, a primary key, and foreign keys, including a self-reference. Before saving, DBX rechecks the source definition, parent key, permissions, and applicable data conditions. If required metadata is unreadable or validation data fails, DBX does not drop the original foreign key first. The database makes the final permission decision for a single ADD statement.
Foreign-key DDL statements commit one at a time. If CREATE succeeds and a later foreign-key statement fails, the table and completed steps remain. DBX stops the remaining steps and does not drop the table, retry, or roll back automatically. A failed existing-key rebuild can also leave the original key absent. Refresh and inspect the actual definitions before retrying. Result details may include recovery SQL that requires manual review.
Foreign-key editing on other databases depends on the implementation for that dialect. Trigger editing depends on source retrieval and safe DDL generation; unsupported databases can still expose source or copyable DDL.
Complete Source for Oracle-Family Triggers
Select a trigger and use Edit full source for complex definitions. This opens the existing source dialog without flattening compound, CALL, WHEN, or other complex clauses into a simple form. For body-only or incomplete reads, keep the correction candidate and obtain an authoritative definition before saving. See Object Browser for states and recovery.
The source dialog updates only that trigger, leaving columns, indexes, constraints, and other trigger drafts intact. If the same trigger has a structured draft or an unknown write result, verify without writing first, then explicitly decide whether to discard only that trigger's structured draft. Other structure drafts remain.
Existing combination limits still apply: indexes, primary keys, constraints, or existing-table foreign keys that require separate saves cannot be mixed with trigger edits. Allowed combinations execute and read back one statement at a time in preview order. Renaming a trigger may drop the old object before creating the new one; a later failure can leave the old trigger absent. DBX stops remaining steps and retains the complete draft and per-step results. Verify state, then preview only necessary remaining changes without automatic rollback or replay.
DDL Preview
Edits do not immediately change the database. Before save, DBX generates highlighted dialect-specific SQL such as:
ALTER TABLE ... ADD/DROP/RENAME/MODIFY COLUMN- Default,
NULL, primary-key, and comment changes CREATE INDEX,DROP INDEX, and rebuild operations- Foreign-key and trigger DDL
- Table-rebuild steps when SQLite requires them
Copy the complete DDL for code review or execution through a migration tool.
NULL, changing primary keys, physical reorder, and table rebuilds can lock tables or lose data. Review execution impact, backups, and rollback plans in production.Save Workflow
Read the latest structure
Confirm that columns, indexes, foreign keys, and triggers are loaded. Refresh first if another client recently changed the table.
Build a local draft
Add, edit, remove, or reorder objects. Deletions remain pending and are not executed yet.
Review DDL
Verify qualification, types, defaults, constraints, indexes, and statement order.
Execute and refresh
Execute after review. Production scope enters production-write confirmation again, and DBX reloads structure after success.
Dialect and Capability Differences
| Dialect/database | Typical behavior |
|---|---|
| MySQL / MariaDB compatible | Broad column properties, physical reorder, primary key, index, foreign key, and comment coverage |
| PostgreSQL / Gauss-compatible | Dialect-aware type/default/null/comment, included/filtered indexes, foreign keys, and related DDL |
| SQLite | Some complex column changes use a safe table-rebuild strategy |
| DuckDB | Supports common column and index operations with behavior distinct from SQLite |
| SQL Server | Column and index changes with dedicated syntax for defaults, included columns, and filtered indexes |
| Oracle / Dameng and similar | Oracle-style column, comment, and index DDL; irrelevant integer-length controls are disabled |
| ClickHouse / Manticore / InfluxDB and others | Only the verified implemented subset is enabled |
| JDBC/Agent | Maps through a recognized dialect and stays read-only when the dialect cannot be identified reliably |
Do not assume that every DDL feature is editable because a database can connect. Use Database Support and the actual editor controls as the current source of truth.
OceanBase Oracle Structure Cloning
The sidebar and Object Browser use the same scope for structure cloning and structure paste: column types and parameters, BYTE/CHAR units, defaults, nullability, primary-key column order, ordinary indexes, and table/column comments. FLOAT binary precision and NUMBER star precision or negative scale are retained. Built-in OceanBase type recommendations use CREATE-column checks against 4.2.5.7; other types can still be entered manually, and recommendations do not replace existing column types.
Before execution, confirmation shows the target, SQL, copied items, and exclusions. Foreign keys, CHECK/UNIQUE constraints, triggers, special indexes, and partition definitions are excluded. UNIQUE constraint backing indexes are excluded too; independent ordinary unique indexes can be copied. Sources with virtual columns or temporary-table properties are rejected. Ordinary target names fold to uppercase, while explicitly double-quoted names retain case: orders_copy creates ORDERS_COPY, and "OrdersCopy" creates OrdersCopy.
Each DDL statement commits separately. Execution stops at the first error without automatic rollback or target deletion. Failure details distinguish confirmed steps, database rejection or unknown results, and steps not executed. Before retrying, refresh and inspect the target using the reported schema and table name; a lost response does not prove creation failed. Native Oracle cloning retains its own scope and is not restricted by these OceanBase exclusions.
Concurrency and Recovery
- Drafts are based on metadata read when the editor opened and do not merge external schema changes automatically
- If execution fails, earlier statements may already have succeeded
- Atomicity of SQLite rebuilds and multi-statement DDL depends on database and driver behavior
- F5 or the toolbar Refresh Structure action reloads structure and may require discarding an unsaved draft
- Read-only connections block save, and production writes require explicit confirmation every time
Recommendations
- Use the editor for focused, single-table changes
- Put copied DDL into version control and review for larger migrations
- Use Schema Diff to align environments
- Use Database Export or Scheduled Database Backups before risky changes
- Combine Field Lineage with application-code search before changing important columns