aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableDump.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-09-14 23:21:07 +0000
committerrowanbeentje <rowan@beent.je>2009-09-14 23:21:07 +0000
commitaf045e33aae9756464e42dc51ea1f4b8cea91097 (patch)
treefa045ac7c9cfdfa2e4d5ce63281724a69e85572a /Source/TableDump.m
parent3ee7b13c203832eba050bae081a2ff5851c0daa3 (diff)
downloadsequelpro-af045e33aae9756464e42dc51ea1f4b8cea91097.tar.gz
sequelpro-af045e33aae9756464e42dc51ea1f4b8cea91097.tar.bz2
sequelpro-af045e33aae9756464e42dc51ea1f4b8cea91097.zip
- Fix an SQL view export error - some MySQL server versions allow NOT NULL DEFAULT NULL, but don't allow definition of tables as that - fix the export of temporary placeholder tables for those views. Thanks to Andreas Falk for report and details.
Diffstat (limited to 'Source/TableDump.m')
-rw-r--r--Source/TableDump.m6
1 files changed, 5 insertions, 1 deletions
diff --git a/Source/TableDump.m b/Source/TableDump.m
index 55f81e1a..994b45bc 100644
--- a/Source/TableDump.m
+++ b/Source/TableDump.m
@@ -2453,8 +2453,12 @@
// Provide the field default if appropriate
if ([column objectForKey:@"default"]) {
+
+ // Some MySQL server versions show a default of NULL for NOT NULL columns - don't export those.
if ([[column objectForKey:@"default"] isEqualToString:@"NULL"]) {
- [fieldString appendString:@" DEFAULT NULL"];
+ if ([[column objectForKey:@"null"] intValue])
+ [fieldString appendString:@" DEFAULT NULL"];
+
} else if ([[column objectForKey:@"type"] isEqualToString:@"TIMESTAMP"]
&& [[[column objectForKey:@"default"] uppercaseString] isEqualToString:@"CURRENT_TIMESTAMP"]) {
[fieldString appendString:@" DEFAULT CURRENT_TIMESTAMP"];