We're a long time SQL Anywhere+Delphi development shop. A lot of our developers have come up with their own simple implementations of how to manage the version of a SQL Anywhere database schema with its related delphi application(s). However we're wanting to standardise how we do this, so thought we'd use this fantasic resource.
By manage, I mean:
So, what do other SQL Anywhere developers use to version control their schema?
Request clarification before answering.
We use PowerDesigner to manage the schema. The CDM and PDM Files are in a classical CVS Repository.
Each Procedures, Function and View is stored a SQL Script.
Changes to the Database are always done by a update script. This scipt uses the read statement to load the scripts and updates the schema. Complex DDL (aka add fields, new tables ) is also scripted in the update file. Each update script is intended to update a database from version x to y. If you have a Database Version v you have to run update w, x and y to get to the current version.
All sql scripts are hold in a CVS Repository.
When we release a new version of the client Application we tag the Scripts and the PD Files in the CVS with the client version they are intended for.
-- --------------------------------------------------------------
-- Update.sql
-- Updates the database from x.yyy to x.zzz
-- $Id$
-- --------------------------------------------------------------
SETTING_CheckSchemaVersion('x.yyy');
-- ==============================================================
message 'DDL Changes' type info to client;
-- ==============================================================
-- ==============================================================
message 'TRIGGER' type info to client;
-- ==============================================================
-- ==============================================================
message 'STORED PROCEDURES' type info to client;
-- ==============================================================
-- ==============================================================
message 'FUNCTIONS' type info to client;
-- ==============================================================
-- ==============================================================
message 'User-defined error messages' type info to client;
-- ==============================================================
read "..\\reload\\UserDefinedError.sql";
-- ==============================================================
message 'User-defined views' type info to client;
-- ==============================================================
-- ==============================================================
-- Update schema version in the SETTING table
-- ==============================================================
insert into SETTING (SET_VARNAME, SET_VALUE, SET_TYPE)
on existing update
values ('SCHEMA_VERSION', 'x.zzz', 'S');
commit;
-- ==============================================================
message 'Data Changes' type info to client;
-- ==============================================================
commit;
The function SETTING_CheckSchemaVersion raises an error when the version in the Database is not equal to what we expect.
We write the DDL manually based on the PDM but you can also use the DDL Script Power Designer can generate and embed them by read "pdchanges.sql"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Each Developer works on his own update main script. When he has finished his work he has to checkout all changes done by others. We use http://winmerge.org/ and http://www.tortoisecvs.org to check for conflicts in changes. Then he can finalize his update script and check in all changes. PowerDesigner has its own Compare and Merge Model possibilities. You have to have the old and new version available to use them.
As you use subversion you know http://tortoisesvn.net ?
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.