Tutorial - Save development database changes to the schema model
Published 17 January 2025
If you make changes to your development database and refresh the schema model page, these changes should show up. You can click on an object at the top to see how it has changed at the bottom.
Select the changes you want to save to your Schema Model. You can select all with the top checkbox or multi select objects using Shift + Click. Click Save to capture the current state of each object in its own file in the schema-model folder.
The latest state of the saved objects are now in the full schema model shown on the right.
These changes are now shown on the right hand side. Clicking an object will show its script.
You can find objects in your schema model by using the 3 dots and choosing Filter.
If you make changes to your development database and refresh the schema model page, these changes should show up. You can click on an object at the top to see how it has changed at the bottom.
You can also multi select objects using Shift + Click.
If you select any changes you want to capture, and then click Save to project, each change will be saved as its own CREATE DDL script in the schema-model folder under your project.
If you go to your project folder or click on the link to the Schema model, then you can see how this is stored on disk:
Run the diff command to get the list of differences and generate an artifact
$ flyway diff -source=development -target=schemaModel Flyway Enterprise Edition 11.2.0 by Redgate Licensed to red-gate.com (license ID 1174ed6b-b10e-41bd-9a1b-285ddc3239c7) See release notes here: https://rd.gt/416ObMi diff artifact generated: C:\Users\Flyway\AppData\Local\Temp\flyway.artifact.diff +-----------------------------+--------+-----------------------+----------------+---------------------------------------+ | Id | Change | Object Type | Schema | Name | +-----------------------------+--------+-----------------------+----------------+---------------------------------------+ | YoZgVMdZR3p7FZEygVaRX9MoF2w | Add | DDL trigger | | ddlDatabaseTriggerLog | | ZKZljmz2_Vvl5wLmV.mczvanHzM | Add | Extended property | | MS_Description | | VYj3ZC0OtkZR4CbJ_JHm9BMkg_c | Add | Full text catalog | | AW2016FullTextCatalog | | qlJstpTbyOQ7nRXTfUvY4lnUDIA | Add | Function | dbo | ufnGetAccountingEndDate | ... | YreyZ8E1z3onEQFgWSGvDqaDUeY | Add | XML schema collection | Production | ProductDescriptionSchemaCollection | | UJr0Z.pCcr8O5ntP1w6H9teL8kQ | Add | XML schema collection | Sales | StoreSurveySchemaCollection | +-----------------------------+--------+-----------------------+----------------+---------------------------------------+
Running the model
command to update the schema model folder
$ flyway model Flyway Enterprise Edition 11.2.0 by Redgate Licensed to red-gate.com (license ID 1174ed6b-b10e-41bd-9a1b-285ddc3239c7) See release notes here: https://rd.gt/416ObMi Saved to schema model File updated: C:\Users\Flyway\FlywayProjects\SqlServerProject\schema-model\Database Triggers\ddlDatabaseTriggerLog.sql File updated: C:\Users\Flyway\FlywayProjects\SqlServerProject\schema-model\Extended Properties\MS_Description.sql File updated: C:\Users\Flyway\FlywayProjects\SqlServerProject\schema-model\Functions\dbo.ufnGetAccountingEndDate.sql ... File updated: C:\Users\Flyway\FlywayProjects\SqlServerProject\schema-model\Views\Sales.vStoreWithContacts.sql File updated: C:\Users\Flyway\FlywayProjects\SqlServerProject\schema-model\Views\Sales.vStoreWithDemographics.sql
Note that the diff command is generating an artifact to a temporary directory that the model command is then using to perform the update operation. This will not be cleaned up although it will be overwritten the next time the diff command is invoked. You may want to configure an explicit artifact location instead.
This tutorial has implicitly selected all the differences in the update. A subset of changes could instead be selected using the ids that appear in the diff output.
Next steps
Optionally save your new project to Version Control:
Then pick one of the following:
- Continue making changes to your development database and saving to the schema model by repeating this process
- Deploy your changes
- Manually deploy your schema model changes to a target database
- Generate migrations to use for deployments