Skip to main content

Module evolution

Module evolution 

Source
Expand description

Changing a table that already holds rows — what this engine keeps through such a change, and the statement it takes to make one.

A first deploy writes CREATE. Every deploy after it has rows to keep, and the two questions a dialect is the only one able to answer are:

  • does the engine keep every value through this change? A column declared to hold ten characters and now declared to hold forty holds everything it held on one engine and is rebuilt by a cast on another. EvolutionAnswers is where a dialect says which it is.
  • what statement does the engine take? Most write ALTER TABLE … ADD COLUMN …, some write ALTER TABLE … ADD …, and a change some engines make with a statement is not a statement other engines have at all. ColumnEvolution is the change, handed over to be spelled.

§Both default to the careful answer

An engine nobody has measured keeps nothing it has not been said to keep, and is given no statement Razeri cannot show it accepts. A dialect that answers nothing here still gets ADD COLUMN, the spelling most engines take, and gets no other statement at all. An engine that writes ADD without COLUMN overrides DdlRenderer::render_column_evolution.

Structs§

EvolutionAnswers
What this engine keeps through a change to a table that already holds rows.
WrittenObject
An object a statement names, spelled the way the statement writes it: its schema as a container is written, its own name through the dialect’s quoting, and the two qualified together.

Enums§

ColumnEvolution
One change to a table that already holds rows, handed to the dialect to spell.
Written
A statement a dialect wrote, and how it ends.