This is a migrated thread and some comments may be shown as answers.

Update database schema

3 Answers 79 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Richard
Top achievements
Rank 1
Richard asked on 24 Oct 2011, 01:15 PM
Hi,

First i create an V 1.0 application with a specific database schema.
And after i deliver a new version of my application V 2.0 and my database schema has changed.

For example, in Version 1.0 i have a table "Person" with ID integer - Name varchar(25)  
In Version 2.0 i have a table "Person" with ID long- Name varchar(100)  - Adress varchar(500)

Question :
==> How can update my database schema v1 --> v2 automatically ?

Remark: I work with OA Version : 2011.1.411.2  (with diagram schema ) and SQL server 2008.
With the previous version, i use "VSchema.exe" tools.
"VSchema.exe" works with my version ?

In advance,
Thanks,
Richard.

3 Answers, 1 is accepted

Sort by
0
Accepted
Zoran
Telerik team
answered on 27 Oct 2011, 03:15 PM
Hi Richard,

 You should use the Update Model from Database and Update Database from Model wizards depending on the direction in which you are trying to perform the update. These wizards are using the VSchema.exe functionality underneath so you will get the same behavior as before.

Regards,
Zoran
the Telerik team

NEW and UPDATED OpenAccess ORM Resources. Check them out!

0
Richard
Top achievements
Rank 1
answered on 27 Oct 2011, 03:39 PM
Hi Zoran,

thanks for your answer....but...
In my case, to update my database schema I don't want to use the wizard. Because....
I would like, when the user launch for the first time my "software GUI version 2" on his computer, that the GUI checks if the database (already installed) is the correct version, if not, "automatically" my GUI update the database schema (like "vschema", to do this action, I used "vschema" with previous version of Open Access).
Can I use "vschema" to update my database schema ? (without user intervention)
Or does it exist another tools or method with the new version of Open Access ?

In advance,
Thanks.
Richard.
0
Zoran
Telerik team
answered on 01 Nov 2011, 06:14 PM
Hi Richard,

 Yes, there is an API that is accessible via the context that will allow you to execute the VSchema functionality. Here is an example:

EntitiesModel context = new EntitiesModel();
ISchemaHandler handler = context.GetSchemaHandler();
string ddlScript = handler.CreateUpdateDDLScript(null);
handler.ExecuteDDLScript(ddlScript);

Regards,
Zoran
the Telerik team

NEW and UPDATED OpenAccess ORM Resources. Check them out!

Tags
General Discussions
Asked by
Richard
Top achievements
Rank 1
Answers by
Zoran
Telerik team
Richard
Top achievements
Rank 1
Share this question
or