Skip to content

Changing the schema ​

The Structure tab ​

Open a table and switch to Structure at the bottom. It lists the Columns (with primary keys, types and nullability), Indexes, Foreign keys and the table's DDL, ready to copy. On PostgreSQL and MySQL it also shows the table's size on disk.

Making changes ​

Every change opens a form, and every form ends in Preview…: you see the exact SQL before anything runs, then click Apply. Destructive changes (truncate, drop table, drop column, drop schema, drop database) ask you to type the name first.

ChangeWhere
New tableCreate… › New Table…, or New Table Here… in the schema menu
Add column, create index, rename, truncate, dropRight-click the table in the sidebar
Rename a column, change its typeRight-click the column in the Structure tab
Drop a columnRight-click the column in the sidebar
New schema, drop schemaCreate… and the schema menu
New database, drop databaseThe database picker

A new table starts with an id integer NOT NULL primary key that you can change. New indexes can be unique and span several columns.

Engine differences ​

  • SQLite cannot change a column's type; recreate the table instead. Truncate runs as DELETE FROM.
  • PostgreSQL drops a schema with CASCADE. SQL Server only drops an empty schema.
  • New database… creates databases on PostgreSQL and MySQL, and runs as soon as you confirm the name, with no preview. Drop database… is PostgreSQL only.
  • Renaming a schema is PostgreSQL only.

Enums ​

  • PostgreSQL: Create enum type… in the schema menu; right-click an enum under Enums to Add value… or Rename value….
  • MySQL: right-click an enum column and choose Edit enum values….

Enum changes run right away, without a preview.

Changes in plain language ​

Change with AI… writes the migration and its rollback from a sentence like add a deleted_at timestamp for soft-delete. See AI in the editor.

ER diagram ​

Map in the sidebar (or Tools › ER Diagram) draws the tables of the current schema and the foreign keys between them.

  • Drag a table to move it. Lily remembers the layout per connection and schema; Reset layout starts over.
  • Export PNG saves the diagram at twice the screen resolution.

Lines come from declared foreign keys, so ClickHouse and Trino show tables without lines. For a diagram based on meaning instead of constraints, use Understand this database.

Lily DB is free for personal and commercial use.