Cool. I misread Wt::Dbo and got a little over-excited when I saw Pandorica and 
'Dr::Who'



________________________________
 From: Marco Gulino <marco.gul...@gmail.com>
To: witty-interest@lists.sourceforge.net 
Sent: Thursday, September 12, 2013 3:32 PM
Subject: [Wt-interest] Wt DBO Migration "module"
 


Hello!
I just wanted to share this little utility I'm using in a couple of my projects 
(one of them, Pandorica, a web media player, is hosted on github here: 
https://github.com/GuLinux/Pandorica , you might want to give a look to it too).
Basically it's a class that brings ruby on rails like migrations in Wt::Dbo, 
versioning your database schema in order to smoothly upgrade it on production 
servers.

You may see what a single migration looks like in here: 
https://github.com/GuLinux/Pandorica/blob/master/src/migrations/comments.h
I have added both an "execute" method for running general purpose statements, 
and various helpers like "createTable", "addColumn", "renameColumn" and so on.
The "CREATE_MIGRATION" macro (defined in here: 
https://git.gulinux.net/web/public?p=Wt-Commons.git;a=blob;f=migratedbo.h;h=f4d2ee2e84a6c966d9c606504d8586b28c113316;hb=HEAD#l38
 ) creates a new method returning a "prepared" migration, you then just pass a 
vector of migrations (and of course, order matters!) to the "MigrateDBO" class, 
and on its destructor the "missing" migrations will be applied.

Of course it's still quite experimental, it only implements a few helpers, and 
it needs a SqlConnection instance (which I understand it's supposed to be a Dbo 
internal, and not used directly) mainly to get Dbo types and to change sql 
dialect based on the backend.
I also had to "emulate" some commands that in sqlite3 are not supported, like 
dropping, renaming and changing a column.
Also remember to define HAVE_SQLITE3, HAVE_MYSQL and HAVE_POSTGRES macros, 
otherwise no backend will be included.

So, the repository where you can find it is in here: 
https://git.gulinux.net/web/public?p=Wt-Commons.git;a=summary and the files 
you're looking for are migratedbo*
There are also a few more utilities, I should think of writing some docs about 
them as they can be quite handy.

Oh, and beware: c++11 only code...

Hope you'll like it, any feedback is welcome!


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to