updating using Migrations with allowNull
updating using Migrations with allowNull
- Subject: updating using Migrations with allowNull
- From: Theodore Petrosky <email@hidden>
- Date: Fri, 21 Mar 2014 08:24:33 -0400
I have a running D2W app and I need to add some booleans to my User.security Entity.
Normally I accomplish this by:
adding the boolean to my postgresql db with migrations:
ERXMigrationTable securityTable = database.existingTableNamed("security");
securityTable.newFlagBooleanColumn("canseeprojects", true);
(I am setting allowsNull to true even thought I want it to be false. )
then I update the security's new attribute to false for current security entries, and change the table to not allowsNull:
/*
* Fix the canseeprojects boolean
*/
ERXJDBCUtilities.executeUpdate(database.adaptorChannel(), "UPDATE security SET canseeprojects = false");
securityTable.existingColumnNamed("canseeprojects").setAllowsNull(false);
Is there an easier way, or is this just an artifact to live with?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden