Skip to content

Database Wizard

The Database WizardUpdate Database Structure — is the reverse direction of the Model Wizard. Where the Model Wizard reads a live database and writes Model YAML files, this one reads the project's Models and writes the DDL that brings the database in line with them.

It is the tool for a project whose models are the source of truth: you design in YAML, and the database follows.

Opening it

From the project file tree, right-click:

  • a single modelUpdate Database Structure… for that table alone
  • the Models folderUpdate Database Structure… for the whole project

What it does

For each selected Model it compares the Model against the live schema and produces:

SituationDDL
The table does not existCREATE TABLE, primary key included
The table exists but differsALTER TABLE ADD COLUMN for a missing field
ALTER TABLE ALTER/MODIFY COLUMN for a changed type, size or nullability
ALTER TABLE DROP COLUMN for a column no Model field claims — opt-in

Fields that produce no column are skipped: Expression and computed fields, and models that are read-only (a view).

Dialects

The SQL dialect is taken from the connection, not chosen by hand:

MSSQL, PostgreSQL, Firebird, Oracle, MySQL, plus a generic ANSI fallback. Identifier quoting and the ALTER syntax (ALTER COLUMN / MODIFY / MODIFY COLUMN) follow the dialect.

The wizard

Four pages: pick the models, choose the options, review the DDL, run it.

  • Options are remembered per project, so the second run starts where you left off
  • The DDL preview is editable: what you see is what runs. Correct it, cut a statement you do not want, or copy the whole script out and run it with your own tools
  • Statements are executed one at a time, with progress and warnings reported as they happen

Defaults

OptionDefault
Create missing tableson
Add missing columnson
Alter changed columnson
Primary keyson
Drop extra columnsoffdestructive: a dropped column takes its data with it
Foreign keysoffemits nothing even when enabled — see the limitations below

Limitations ##

  • No FOREIGN KEY is emitted, with the option on or off. The generator only considers a reference field that declares no sub-field, and a well-formed KittoX reference always declares one (the Fields: node the framework requires), so nothing is produced. Add the constraints by hand on the preview page if you need them.
  • The match between an existing column and a Model field is approximate: only the SQL type category is compared — the one GetColumnTypeSQL would emit — not size, precision or nullability, because those are reported differently by each driver and produced ALTERs on tables that were in sync. An ALTER therefore appears when the category changes (string to integer), while a pure size, precision or NULL/NOT NULL change is not detected
  • No data migration: an ALTER that narrows a column is the database's problem, not the wizard's

Because of these, the DDL preview is not a formality. Read it before you run it.

Under the hood

The engine (KIDE.DatabaseCreator) is headless and reusable: it holds no form and no UI, so the MCP server can drive the same diff-and-DDL logic for an AI agent working on the project.

Released under Apache License, Version 2.0.