Our product supports multiple databases. At the moment, we support FireBird and MSSql and there is future support coming for Oracle.
When we push out an update for our product there is the potential that we also need to update the client’s database schema as well.
Traditionally we have scripts that are flavored to the DB version which would do things like “Alter table add column” which are executed in order to bring the database up to the correct version. This is becoming a hassle because we have to maintain two sets of sql scripts (with more on the way if we add Oracle to the mix).
We use the Entity Framework in our db layer. The EF already contains a schema of the database. I wonder – is there a slick way to use the EF and it’s knowledge of the schema to handle the updates to the client DB?
EDIT –
This is EF 4.0
You haven’t mentioned which version of EF you are using. In V4, you can use the “Code First” model. Check out ScottGu’s post. I’m not 100% sure if it is supported across all the DBs you need though. [edit]This will only create new schemas, not update existing schemas[/edit]
It might be some work, but it may be worth switching to nHibernate, which supports a wider variety of DBs and auto-updates the schema.