aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-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"];