mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-31 00:22:30 +00:00
62 lines
2.3 KiB
Plaintext
62 lines
2.3 KiB
Plaintext
---
|
|
title: Table Structure Editor
|
|
description: Edit table columns and indexes visually, then preview DDL before applying changes.
|
|
---
|
|
|
|
The table structure editor modifies columns, indexes, and some constraints for a single table. Use it for focused structure changes or to generate reviewable DDL without writing it by hand.
|
|
|
|
## What You Can Edit
|
|
|
|
| Object | Supported Actions |
|
|
|---|---|
|
|
| Columns | Add and delete columns; MySQL/PostgreSQL can modify existing columns, and SQLite can rename columns |
|
|
| Indexes | Add indexes and delete existing non-primary indexes |
|
|
| Comments | MySQL/PostgreSQL can write column comments; PostgreSQL can write index comments |
|
|
|
|
Database engines differ in DDL capabilities. DBX generates SQL for the active connection type.
|
|
|
|
## Workflow
|
|
|
|
<Steps>
|
|
<Step>
|
|
### Open Table Structure
|
|
|
|
Right-click a table in the sidebar and open its structure view.
|
|
</Step>
|
|
<Step>
|
|
### Edit Columns or Indexes
|
|
|
|
Add, modify, or remove columns and indexes in the visual editor. Changes are staged locally first.
|
|
</Step>
|
|
<Step>
|
|
### Review SQL Preview
|
|
|
|
Before saving, review generated statements such as `ALTER TABLE`, `CREATE INDEX`, and `DROP INDEX`.
|
|
</Step>
|
|
<Step>
|
|
### Apply Changes
|
|
|
|
Execute the SQL only after confirming it matches your intent.
|
|
</Step>
|
|
</Steps>
|
|
|
|
<Callout type="warn">
|
|
Dropping columns, changing column types, and changing nullable constraints can affect existing data. Back up production databases first and confirm application code does not depend on the old structure.
|
|
</Callout>
|
|
|
|
## Engine Differences
|
|
|
|
| Engine | Notes |
|
|
|---|---|
|
|
| MySQL / MariaDB | Add, delete, and modify columns; add and delete indexes |
|
|
| PostgreSQL | Rename columns, change type/default/nullability/comments, and add/delete indexes |
|
|
| SQLite | Add, delete, and rename columns; more complex existing-column edits are blocked with a warning |
|
|
| SQL Server / Oracle and others | Adding columns and indexes is available; editing existing columns is currently blocked by the editor |
|
|
|
|
## Recommendations
|
|
|
|
- Use the editor for small, focused changes
|
|
- For large migrations, generate SQL and review it in your code repository
|
|
- For environment sync, use [Schema Diff](/en/docs/schema-diff)
|
|
- When impact is uncertain, back up first with [Database Export](/en/docs/database-export)
|