2009/10/11 Octavian Râşniţă <orasn...@gmail.com>

> Thank you all for your answers. It was very helpful.
> What about the database? If starting from a certain revision you need to
> make some database changes (adding tables, adding/deleting some table
> fields) how can we automate this?
>

Every database update is slightly different, so automating hasn't seemed
possible.

The applications includes a script to build a test database.  The test
database is saved in svn with each application.   The test files can load
this database to test against when running make test.  That stays in sync
with development.

I also have a cron job running on a test server that does an svn checkout
when the revision number changes (for branches or trunk) and runs tests
against this test database.


> I mean, I think that we could run a script that add some tables and remove
> the unneeded fields from other tables, but if something goes wrong and we
> need to go back to the previous version, we would need the records from
> those fields.
>

The database is more complex.  We create a set of change files that the DBA
applies.  I like hand creating these and filling them with comments on why a
column is added or dropped, and the tickets they apply to.  They are in svn
(for a history) but also in a web app the DBA uses to track what's been
applied and what is scheduled to apply.

It's very rare that a release includes database changes that have to be done
at the moment of pushing the new version.  Schema changes happen first.
That is, the database is ready for the new features before the application
is pushed.  Sometimes constraints have to be added in after pushing the
release.  Bigger changes require a service window, of course.  In those
cases I have created a script that makes the database changes, populates
tables and runs tests.

Once changes are in the database tests can be run against a snapshot of the
production db instead of the test database.

I'd like to have it more automated, but it seems like every database change
requires something special.




-- 
Bill Moseley
mose...@hank.org
_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to