Synchronizing Database Schema

Synchronizing database schema changes with your application

Go to:

Tools, Synchronize Database Schema

 

Tools, Synchronize Database Schema (Scan Only)

 

Tools, Accept Changes for Selected Table

When you change the underlying database tables upon which your application is built, you need to inform Iron Speed Designer of these changes so that Iron Speed Designer creates code matched to your updated table schemas.  You can do this using Iron Speed Designer’s database schema synchronization feature.  Synchronizing your database schema allows Iron Speed Designer to rebuild your application using the updated database schema.

These database modifications require you to synchronize (refresh) your database schema with your application.

 

Adding

Renaming / Changing

Deleting

Table

 

ü

ü

Primary key

ü

ü

ü

Table fields

ü

ü

ü

Table field type

 

ü

 

Table field size

 

ü

 

Default field value

ü

ü

ü

Foreign key relationship

ü

ü

ü

To synchronize your database schema, select Databases, Synchronize Database Schema.  Your application’s database is searched for tables that may require refreshing due to changes in the underlying table definitions.  Iron Speed Designer is refreshed with the updated schema.  Your application will incorporate the new database changes the next time you build your application.

To accept changes on a table-by-table basis, select Databases, Accept Changes for Selected Table.  This gives you the opportunity to de-select any tables you do not wish to synchronize.  The tables highlighted in the Application Explorer tree are refreshed.  Your application will incorporate the new database changes the next time you build your application.

Your application may change due to schema synchronization

When database schema scanning occurs, Iron Speed Designer tries to minimize changes to your application pages.  For example, when new fields are added to a table schema, those new fields are not automatically added to your page.  And, simply renaming a field won’t change the page or its underlying database query.

However, there are cases when database schema synchronization may change something on a page.  An obvious example is when tables or fields are deleted, which requires Iron Speed Designer to remove those fields from your application pages and update the underlying code so your application will compile and run without any problems.  If a table is deleted, any queries referencing that table must be updated to remove the reference.  Similarly, when a field is deleted, it is removed from all application pages, and any WHERE clause in a query referencing the field will also be removed.

Changing a field type will also force an update to your application.  For example, changing a field from NVARCHAR(50) to NTEXT will cause a change on the page and in the underlying query as well.  Changing field sizes may also force an application update.  For example, changing a the field’s data type from NVARCHAR(200) to NVARCHAR(300) in Microsoft SQL Server is really is a change to the data type column in SQL Server Enterprise Manager, and is reported to as such to Iron Speed Designer.

Database queries that do not reference a changed field are not changed.  If, for example, you changed Field 3, and a particular database query uses Field 5, there will be no change to the query.  Similarly, renaming Field 3 to Field 7 will also change any page and any query using Field 3.

Renaming fields: mapping field name changes with the Map Field dialog

A database field may be considered new if you renamed the field, its schema order was changed or its type was changed.  You can use the Map Field dialog to identify the old field currently used by Iron Speed Designer to its new (renamed) counterpart in the database schema.  By mapping the old field to the new one, you can retain previously entered table and page properties.

Access the Map Field dialog from Databases.

Renaming your database

Iron Speed Designer cannot detect when you’ve renamed your database.  To modify your application to use a renamed database, change your database’s name in your application’s Web.config file.  This will preserve all the changes you have made to the application as the application is essentially pointing to the same database but with a different name.

Renaming tables

Iron Speed Designer cannot detect when you’ve renamed a table and unfortunately no mechanism exists to map table name changes.

Deleting tables from your database

If you delete a database table and then resynchronize your database schema, Iron Speed Designer will ‘unbind’ any pages, reports, forms and fields referring to the deleted table.  The pages and panels will continue to exist, but no data will be displayed.

Changing database field length

If you change the length of a database field and synchronize your database schema, Iron Speed Designer will update the new field width throughout your application.  This is necessary in order for you application to properly fetch and store data based on the exact field length.  If the field is used in a WHERE clause specified via the Query Wizard, the WHERE clause is removed and must be manually added back via the Query Wizard.

Text box columns are not updated when field length changes

The ‘Text box columns’ values for various fields are not changed if your database schema changes.  Doing so would alter the layout of your existing application pages.  For example, if your application has 1000 pages, and each was updated with the new ‘Text box columns’ length, the time required to undo these changes would be very long.

You can set the ‘Text box columns’ value globally for a specific field via Databases.

Some code customizations may require manual updating

If you have previously created pages with the schema, Iron Speed Designer may not automatically change the page to reflect the changes you have made to the database schema.  This is because Iron Speed Designer does not know whether you have made changes to the page and would like it a certain way.  If Iron Speed Designer were to automatically make the changes, your customizations on the page will be overwritten every time you can scan database for changes.

You will need to change your page, or recreate the page if you want the changes to be reflected on the page.  Specifically, these changes may not be reflected:

If you have not made many changes to the page, simply recreate the page to let Iron Speed Designer choose the best control type for each field.  If you have modified the page, change the display type for each modified field via the Property Sheet to reflect the changes.

Removing Database Connections

Step 1: Scan schema and accept changes with the database connection that you wish to unlink. You need to make sure your application is in a healthy state.

Step 2: Create a dummy database with no tables.

Step 3: In the web.config file, locate the connection string for the database that you wish to unlink. Change the data source and database name to be the dummy database.

Step 4: Scan schema and accept changes.

Step 5: Build the application. During the build process, Iron Speed Designer will search for the code and xml files to be removed in the Data Access and Business Layer.

Step 6: On Iron Speed Designer, delete any presentation layer files you don't want to keep. (Don't try to delete it from Visual Studio or Window explorer)

Step 7: Delete any menu references to the removed pages.

Step 8: Close Iron Speed Designer

Step 9: Delete the connection string of the dummy database using notepad in the web.config file.

 

Database synchronization properties

A database field may be considered new if you renamed the field, its schema order was changed or its type was changed.  You can use the Map Field dialog to identify the old field currently used by Iron Speed Designer to its new (renamed) counterpart in the database schema.  By mapping the old field to the new one, you can retain previously entered table and page properties.  See Synchronizing Database Schema for details.

Property

Description

Map field to

Identifies the previous name of this field.