Skip to content

Migrations, Change History, and Target Strategy

Complete migration reference for generation, apply, rollback, inspection, recovery, and deployment across targets.

Introduction

Use this tour when you need the complete Database Manager story instead of only a single table action. The goal is to connect schema design, relation choices, Apply Database Changes, migration files, environment strategy, and publish-time database updates into one practical workflow.

Design schema changes in development first
Treat migrations as the repeatable history of those changes
Publish only after the development target proves the update works

Start with the development database you actually control

Database Manager work should start on a development target, not directly on the live production schema. Create the table, field, and relation changes where you can still revise them safely, then let the rest of the stack catch up around that schema before you ever publish it outward.

Create tables and add fields deliberately

Start with the smallest table shape that truly represents the records you need. Create the table, add the fields you know are required, and name them as if future queries, forms, and server actions will depend on them, because they will. The cleaner the structure is here, the less friction you create later in Query Builder, form binding, validation, and update actions.

Choose the right relation shape before you apply anything

This is the key modeling decision point. Use a normal reference when one record points to one parent, a sub table when a parent owns a nested child collection, and a multi reference when both sides can have many links. Making that choice before you apply changes is what keeps the later schema, queries, and editing flows understandable instead of patched together.

Reference for one-to-many parent links
Sub table for owned nested child rows
Multi reference for many-to-many links

Apply Database Changes turns your design into tracked schema changes

The Apply Database Changes button is the deliberate handoff from design intent to executable schema history. Use it after the table, field, and relation changes make sense together. The point is not just to save the current view of the tree. The point is to generate the migration history that can be replayed safely on other targets later.

Apply validates, describes, generates, and runs the change

Apply Database Changes first validates pending schema edits. Wappler then asks for a meaningful description, generates an ordered migration with an up path and a reverse down path, applies it through the active connection, refreshes schema, and regenerates the connection metadata. The description should explain intent, not merely repeat a table name.

Stage Result
ValidateStops invalid table, field, or relation definitions before database execution.
DescribeNames the change history entry so teammates can understand it.
GenerateWrites ordered up/down schema operations.
ApplyRuns the new migration on the active development connection.
RefreshReloads schema and regenerates connection metadata.

Open the live Changes context menu

This opens the current Changes branch menu. It centralizes latest-batch migration operations and recovery actions. The tour only displays these commands; it does not modify history.

All migration history actions

Latest-batch actions are normal day-to-day migration controls. Reset and Unlock are recovery tools and should be used only after inspecting the database and coordinating with the team.

Selection Action and meaning
ChangesApply Latest Changes: run the newest pending migration batch.
ChangesRollback Latest Changes: execute the down path for the latest applied batch.
Done migrationUndo This Change: reverse that applied migration.
Pending migrationApply This Change: run that one pending migration.
Migration fileOpen In Editor: inspect the generated migration source.
ChangesReset Changes History: after confirmation, clears the wappler_migrations tracking table.
ChangesUnlock Changes History: after confirmation, clears the migration lock table when a failed/interrupted run left it locked.

Done and Pending keep state explicit

Applied migration files live under Done and unapplied files under Pending. Right-click the individual entry for Undo This Change or Apply This Change and Open In Editor. This per-file path is useful when you need a controlled correction; use latest-batch actions when the ordered batch is the intended unit.

What the migration files actually mean

Migration files are the ordered record of how the database schema should change over time. They are not row edits or backups. Each file carries up/down structural operations such as creating or altering a table, field, reference, junction table, or sub table so another target can reproduce and, when supported, reverse the same update in order.

They capture schema history, not table-row edits
They let other targets reproduce the same structural update
They are the safe bridge between development work and live schema updates

Test the changes on development targets first

After the migration files exist, keep working against the development target until the app behavior proves the schema is correct. Update or test the affected queries, forms, server actions, validators, and seeded data there first. This is where you catch naming mistakes, missing fields, and relation assumptions before the same migration reaches a real deployment.

Run the affected actions and forms against the development database
Verify that lists, inserts, updates, and validation still match the new schema
Only promote the change once the app works with the migrated development target

Choose a database strategy that fits the project

Not every project needs the same target layout. A small one-person project can sometimes keep one shared database if the risk is low and the workflow is simple. A larger team, a staging workflow, or any project where testing and release timing matter should usually keep separate databases per target or environment so development changes cannot surprise the live system.

Shared database can work for small solo projects with simple risk
Separate databases are safer for teams, staging, and scheduled releases
The more people and environments involved, the more valuable separation becomes

Publish applies the approved schema to the live target

When the project is ready, the publish flow is where the approved migration history moves to the live environment. That means the live target receives the same structural updates you already proved on development, instead of you manually rebuilding the schema by hand. This is the safer deployment story: design in Database Manager, test in development, then publish with migrations so the live database is updated as part of the release workflow.

Publish the tested migration history, not an unproven schema guess
Let the live target replay the same structural changes you already validated in development

Next steps

Return to the main Database Manager hub when you are ready for the next subject. That keeps the database learning path sequential, with the main hub acting as the place to choose the next lifecycle, recipe, or reference topic.

Open Sub Tables or Multi References for concrete relation patterns
Use Publish Manager when you are ready to release the approved migration set
Return to the Database Manager hub for the broader panel map