summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-10-19 12:11:49 -0700
committerBrion Vibber <brion@pobox.com>2010-10-19 12:11:49 -0700
commite07254d15b96e6c312543a15725bef4de1c2d8f2 (patch)
treeae252d1360cd64888ca7b02e31e394a8e3d5a38e
parent7751d455de464f29988de6c5a3128f9ca8357403 (diff)
$config['db']['mysql_foreign_keys'] option to experimentally enable foreign keys on MySQL. (Would only work on InnoDB tables, may explode, etc)
-rw-r--r--lib/default.php3
-rw-r--r--lib/mysqlschema.php5
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/default.php b/lib/default.php
index a1dac7b5e..26b872da4 100644
--- a/lib/default.php
+++ b/lib/default.php
@@ -75,7 +75,8 @@ $default =
'schemacheck' => 'runtime', // 'runtime' or 'script'
'annotate_queries' => false, // true to add caller comments to queries, eg /* POST Notice::saveNew */
'log_queries' => false, // true to log all DB queries
- 'log_slow_queries' => 0), // if set, log queries taking over N seconds
+ 'log_slow_queries' => 0, // if set, log queries taking over N seconds
+ 'mysql_foreign_keys' => false), // if set, enables experimental foreign key support on MySQL
'syslog' =>
array('appname' => 'statusnet', # for syslog
'priority' => 'debug', # XXX: currently ignored
diff --git a/lib/mysqlschema.php b/lib/mysqlschema.php
index b21008518..937c20ea8 100644
--- a/lib/mysqlschema.php
+++ b/lib/mysqlschema.php
@@ -400,8 +400,9 @@ class MysqlSchema extends Schema
$col['type'] = $this->mapType($col);
unset($col['size']);
}
- // @fixme add foreign-key support for MySQL
- unset($tableDef['foreign keys']);
+ if (!common_config('db', 'mysql_foreign_keys')) {
+ unset($tableDef['foreign keys']);
+ }
return $tableDef;
}
}