aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/db
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-06-04 18:15:58 +0200
committerVincent Petry <pvince81@owncloud.com>2014-06-04 18:17:46 +0200
commitd4ffafe4674dbda984c78ea9f7db894156e2a764 (patch)
tree80206d4c25c38092219ca74b4170893ade376e3f /lib/private/db
parent5b97369b00afbdf55eed145be9ac981dca06d2a9 (diff)
downloadnextcloud-server-d4ffafe4674dbda984c78ea9f7db894156e2a764.tar.gz
nextcloud-server-d4ffafe4674dbda984c78ea9f7db894156e2a764.zip
Removed simulate db update flag and split into separate methods
Diffstat (limited to 'lib/private/db')
-rw-r--r--lib/private/db/mdb2schemamanager.php37
1 files changed, 25 insertions, 12 deletions
diff --git a/lib/private/db/mdb2schemamanager.php b/lib/private/db/mdb2schemamanager.php
index 397aaf3608a..734ba18d1ac 100644
--- a/lib/private/db/mdb2schemamanager.php
+++ b/lib/private/db/mdb2schemamanager.php
@@ -74,33 +74,46 @@ class MDB2SchemaManager {
}
/**
+ * Reads database schema from file
+ *
+ * @param string $file file to read from
+ */
+ private function readSchemaFromFile($file) {
+ $platform = $this->conn->getDatabasePlatform();
+ $schemaReader = new MDB2SchemaReader(\OC_Config::getObject(), $platform);
+ return $schemaReader->loadSchemaFromFile($file);
+ }
+
+ /**
* update the database scheme
* @param string $file file to read structure from
* @param bool $generateSql only return the sql needed for the upgrade
- * @param bool $simulate whether to simulate on separate tables instead of the real onces
* @return string|boolean
*/
- public function updateDbFromStructure($file, $generateSql = false, $simulate = false) {
-
- $platform = $this->conn->getDatabasePlatform();
- $schemaReader = new MDB2SchemaReader(\OC_Config::getObject(), $platform);
- $toSchema = $schemaReader->loadSchemaFromFile($file);
+ public function updateDbFromStructure($file, $generateSql = false) {
+ $toSchema = $this->readSchemaFromFile($file);
$migrator = $this->getMigrator();
if ($generateSql) {
return $migrator->generateChangeScript($toSchema);
} else {
- if ($simulate) {
- $migrator->checkMigrate($toSchema);
- }
- else {
- $migrator->migrate($toSchema);
- }
+ $migrator->migrate($toSchema);
return true;
}
}
/**
+ * update the database scheme
+ * @param string $file file to read structure from
+ * @return string|boolean
+ */
+ public function simulateUpdateDbFromStructure($file) {
+ $toSchema = $this->readSchemaFromFile($file);
+ $migrator = $this->getMigrator()->checkMigrate($toSchema);
+ return true;
+ }
+
+ /**
* @param \Doctrine\DBAL\Schema\Schema $schema
* @return string
*/