Servoy 4.0 Versioning of database changes?

Discuss all feature requests you have for a new Servoy versions here. Make sure to be clear about what you want, provide an example and indicate how important the feature is for you

Servoy 4.0 Versioning of database changes?

Postby mxvanzant » Mon Feb 11, 2008 6:44 pm

In Servoy 4.0, will it be possible for database changes to be kept under version control (such as with Subversion)? Or, will we have to do this outside of Servoy? This is a request to allow version control of DB changes from within Servoy 4.0.

By the way, are we going to see the 4.0 beta anytime soon? : )

Thanks!
Mike VanZant
mxvanzant@yahoo.com
vanzant@orangeloft.com
Orange Loft LLC
mxvanzant
 
Posts: 17
Joined: Fri Aug 24, 2007 5:33 pm
Location: Wheeling, IL (Chicago burb)

Postby swingman » Tue Feb 12, 2008 10:19 am

Hi Mike,

It will be interesting to see what the Servoy team comes up with in this respect. Meanwhile I have developed my own method of version control, borrowing from Ruby-on-Rails.

If you are using any database supported by Rails, mySQL, PostgreSQL etc you can point an empty rails project at your Servoy project and run Migrations on your database.

On Mac OS X 10.5 it is pre-installed:

Code: Select all
rails myServoyProject


Go to 'db/database.yml' and edit the database connections. Make sure you point the 'test' connection to an empty database as the test database gets deleted and recreated if you ever were to run a test.

Then

Code: Select all
script/generate migration OrderAdditions


This creates a file called 001_order_additions
Then you can write Ruby code to modify the database

Code: Select all
class OrderAdditions < ActiveRecord::Migration
  def self.up
    add_column :orders, :submitted, :integer
    add_column :orders, :processed, :integer
    remove_column :orders, :order_sid
  end

  def self.down
    remove_column :orders, :submitted
    remove_column :orders, :processed
    add_column :orders, :order_sid, :string,:default => "", :null => false
  end
end


self.up/self.down means you can step forward or backwards between versions. This code is database neutral unless you execute SQL directly using the 'execute()' command. You can check the whole project directory into Subversion or some other source control.

Then you run

Code: Select all
rake db:migrate


which will modify your development database, or,

Code: Select all
rake db:migrate RAILS_ENV=production


to modify the production server.

You do need to restart Servoy after running migrations.

I'm currently using this technique to clean up a large Servoy system which has its roots back in Servoy version 1.2. I have about 15 migration files with maybe 1,000 changes. When ready to deploy, I only need to run

Code: Select all
rake db:migrate RAILS_ENV=production


once. And the structure of my production database with my latest data will be up-to-date.

Rails creates a single table

Code: Select all
CREATE TABLE schema_info
(
  "version" integer
)


keeping track of the current version of your database.
When writing migrations, you can manipulate the 'version' number you can run the same migration again if it was to fail.

Anyway,

let's see what the Servoy team comes up with ;-)
Christian Batchelor
Certified Servoy Developer
Batchelor Associates Ltd, London, UK
http://www.batchelorassociates.co.uk

http://www.postgresql.org - The world's most advanced open source database.
User avatar
swingman
 
Posts: 1472
Joined: Wed Oct 01, 2003 10:20 am
Location: London

Postby mxvanzant » Tue Feb 12, 2008 6:57 pm

Christian,

Thank you for the great idea! We will probably use this if Servoy 4.0 does not do the job.

Mike
Mike VanZant
mxvanzant@yahoo.com
vanzant@orangeloft.com
Orange Loft LLC
mxvanzant
 
Posts: 17
Joined: Fri Aug 24, 2007 5:33 pm
Location: Wheeling, IL (Chicago burb)

Postby bcusick » Wed Feb 20, 2008 12:08 am

4.0 will allow the use of CVS or Subversion - or you can do as Christian suggested as well.
Bob Cusick
bcusick
 
Posts: 1255
Joined: Wed Apr 23, 2003 11:27 pm
Location: Thousand Oaks, CA USA

Postby ryanparrish » Wed Feb 20, 2008 1:05 am

bcusick wrote:4.0 will allow the use of CVS or Subversion - or you can do as Christian suggested as well.


Are you saying 4.0 will have built-in support for versioning of the schema, or just that will be able to VC your methods (and forms?) that we have heard about?
ryanparrish
 
Posts: 162
Joined: Thu May 17, 2007 7:49 pm
Location: Miami, FL


Return to Discuss Feature Requests

Who is online

Users browsing this forum: No registered users and 10 guests

cron