aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-07-24 16:14:05 +0200
committerGitHub <noreply@github.com>2018-07-24 16:14:05 +0200
commit7da815bb0403ebb072866b61779a84835b9a74b8 (patch)
tree12936604c35b366ae894327193054d9b03f04618 /lib/private
parentd67e18b28e35ce395fafa5f37f19f50965fc7dd5 (diff)
parent891de38080f27011cb050301c7948b52e3141470 (diff)
downloadnextcloud-server-7da815bb0403ebb072866b61779a84835b9a74b8.tar.gz
nextcloud-server-7da815bb0403ebb072866b61779a84835b9a74b8.zip
Merge pull request #10298 from nextcloud/bugfix/talk-714/only-migrate-the-schema-when-moving-database
Only create the schema when moving between databases
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/DB/MigrationService.php24
1 files changed, 15 insertions, 9 deletions
diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php
index cc2889dae0c..6f5a74103a5 100644
--- a/lib/private/DB/MigrationService.php
+++ b/lib/private/DB/MigrationService.php
@@ -376,13 +376,14 @@ class MigrationService {
* Applies all not yet applied versions up to $to
*
* @param string $to
+ * @param bool $schemaOnly
* @throws \InvalidArgumentException
*/
- public function migrate($to = 'latest') {
+ public function migrate($to = 'latest', $schemaOnly = false) {
// read known migrations
$toBeExecuted = $this->getMigrationsToExecute($to);
foreach ($toBeExecuted as $version) {
- $this->executeStep($version);
+ $this->executeStep($version, $schemaOnly);
}
}
@@ -432,14 +433,17 @@ class MigrationService {
* Executes one explicit version
*
* @param string $version
+ * @param bool $schemaOnly
* @throws \InvalidArgumentException
*/
- public function executeStep($version) {
+ public function executeStep($version, $schemaOnly = false) {
$instance = $this->createInstance($version);
- $instance->preSchemaChange($this->output, function() {
- return new SchemaWrapper($this->connection);
- }, ['tablePrefix' => $this->connection->getPrefix()]);
+ if (!$schemaOnly) {
+ $instance->preSchemaChange($this->output, function() {
+ return new SchemaWrapper($this->connection);
+ }, ['tablePrefix' => $this->connection->getPrefix()]);
+ }
$toSchema = $instance->changeSchema($this->output, function() {
return new SchemaWrapper($this->connection);
@@ -450,9 +454,11 @@ class MigrationService {
$toSchema->performDropTableCalls();
}
- $instance->postSchemaChange($this->output, function() {
- return new SchemaWrapper($this->connection);
- }, ['tablePrefix' => $this->connection->getPrefix()]);
+ if (!$schemaOnly) {
+ $instance->postSchemaChange($this->output, function() {
+ return new SchemaWrapper($this->connection);
+ }, ['tablePrefix' => $this->connection->getPrefix()]);
+ }
$this->markAsExecuted($version);
}