On 02/07, David Lutterkort wrote: > On Thu, 2013-02-07 at 15:35 +0100, mfoj...@redhat.com wrote: > > From: Michal Fojtik <mfoj...@redhat.com> > > > > Currently everytime we add or remove attributes from > > DB, users need to rerun the 'rake' task to recreate the > > database. > > > > This patch will make possible to update the DB schema > > without executing the rake task. > > > > The 'migrations' extension in Sequel will check the 'schema_version' > > table and apply all migrations >= than the current schema. > > > > Migrations must be prefixed with the schema number in chronological > > order and they are stored in server/lib/db/migrations. > > We definitely need migrations - I don't like though that they are > automatically applied when the server starts. They should be applied by > a separate command (either a rake task or a small script in bin/) - this > is important both for dev, so you can go back and forth between the > schema changes you're working on, and for prod where you want to make > sure people take a DB dump etc. before migrating the database.
Yes, good points. I was trying to mimic the way how Datamapper is working, so for the user it would be transparent that the schema was updated. I will add both rake task and small helper with Migrator in next rev. > Also, migrations should go into server/db/migrations, since they are not > needed (or wanted) while the server is running. Yes, definitely. Will move them there. > > David > > -- Michal Fojtik <mfoj...@redhat.com> Deltacloud API, CloudForms