On Mar 13, 2007, at 12:14 PM, James Masters wrote: > I'm converting an old textual database to MySQL with Rose. > > MySQL has 3 options for a date: > a date > 0000-00-00 > NULL
my suggestion: don't declare your date column as "NOT NULL" , when migrating , convert 0000-00-00 to NULL the purpose of a date column is to put a date in it. the purpose of a null/not null restriction, is whether or not you must define that column 0000-00-00 is a dirty hack to pretend that you have a value in a not null field. its defeating the concept of null/not null. > My scripts currently have a date either as "" or a date. So > presumably my > empty date "" needs to be mapped to either 0000-00-00 or NULL in > MySQL. you should handle the "" as undef. undef means there is no date "" means the date is an empty string > date fields in MySQL schema, is it best for me to allow NULL and > then make > empty dates map to NULL? Or is it best to disallow NULL and then > make empty > dates map to 0000-00-00? allow NULL and treat empty dates as undef in your perl code a) 0000-00-00 is a mysqlism for putting null dates in a not-null field -- most other dbs will not accept that as a date. b) many apps / modules across languages are designed to throw errors on invalid dates -- especially ones like that > And final question, how DO you set a field to NULL with Rose, anyway? undef // Jonathan Vanasco | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | SyndiClick.com | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | FindMeOn.com - The cure for Multiple Web Personality Disorder | Web Identity Management and 3D Social Networking | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | RoadSound.com - Tools For Bands, Stuff For Fans | Collaborative Online Management And Syndication Tools | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object