Modify an existing database schema utilizing a database independent approach.
Updating an existing database schema is a feature that has been requested and that Developer Express may eventually implement (see: A581 and AS4684). However, since this is a feature that I would like to use now, I decided to implement it here. Xpo.UpdateSchema is written using C# in Visual Stuido 2008 and uses version 3.5 of the .NET framework.
DevExpressContrib.Xpo.UpdateSchema currently modifies three things within an existing XPO generated schema.
Schema Updates:
- Update the size of a string column.
- Delete a column.
- Rename a column.
It performs these tasks by using attributes and database specific providers (similar to XPO functionality). Xpo.UpdateSchema currently has providers for the following databases.
Providers:
- Microsoft SQL Server (tested using SQL Server 2005 Express Edition)
- Microsoft Access (tested using the default Jet engine under Microsoft Windows XP)
- VistaDB 3
- Sybase SQL Anywhere
DevExpressContrib.Xpo.UpdateSchema also provides a way to validate and update a schema version if desired. Any object which implements an ISchemaVersion interface can be passed to DevExpressContrib.Xpo.UpdateSchema to perform this task.
Features that still need to be implemented:
- Write more tests. In fact, the tests that are currently supplied for DevExpressContrib.Xpo.UpdateSchema are not unit tests - they are integration tests. They directly access the databases. These should be kept but actual unit tests should also be included.
- Ensure that heirarchical persistent classes work properly - this has not yet been tested.
NOTES:
- The bonus providers (currently, ASA and VistaDB3) are commented out for shipping. This is to allow people to easily compile DevExpress Contrib. To use one of these bonus providers, uncomment the provider and recompile.
Additional providers will be added as time permits (and if I have access to the database engines). If you would like to contribute a provider please contact me.