summaryrefslogtreecommitdiffstats
path: root/core/Migrations
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-08-14 09:52:07 +0200
committerJoas Schilling <coding@schilljs.com>2017-08-14 09:52:41 +0200
commit601f7951220fcbf896b8f50b772890f8adeb6267 (patch)
treeff6dbea2d3737e5c313d2ed57eb0be764af5e324 /core/Migrations
parent073216e8278983abef6ac51d6e0a900f95af0024 (diff)
downloadnextcloud-server-601f7951220fcbf896b8f50b772890f8adeb6267.tar.gz
nextcloud-server-601f7951220fcbf896b8f50b772890f8adeb6267.zip
Make sure the accounts table exists
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'core/Migrations')
-rw-r--r--core/Migrations/Version13000Date20170814074715.php59
1 files changed, 59 insertions, 0 deletions
diff --git a/core/Migrations/Version13000Date20170814074715.php b/core/Migrations/Version13000Date20170814074715.php
new file mode 100644
index 00000000000..764ab8ab84e
--- /dev/null
+++ b/core/Migrations/Version13000Date20170814074715.php
@@ -0,0 +1,59 @@
+<?php
+namespace OC\Core\Migrations;
+
+use Doctrine\DBAL\Schema\Schema;
+use OCP\Migration\SimpleMigrationStep;
+use OCP\Migration\IOutput;
+
+/**
+ * Auto-generated migration step: Please modify to your needs!
+ */
+class Version13000Date20170814074715 extends SimpleMigrationStep {
+
+ /**
+ * @param IOutput $output
+ * @param \Closure $schemaClosure The `\Closure` returns a `Schema`
+ * @param array $options
+ * @since 13.0.0
+ */
+ public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
+ }
+
+ /**
+ * @param IOutput $output
+ * @param \Closure $schemaClosure The `\Closure` returns a `Schema`
+ * @param array $options
+ * @return null|Schema
+ * @since 13.0.0
+ */
+ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
+ /** @var Schema $schema */
+ $schema = $schemaClosure();
+
+
+ if (!$schema->hasTable('accounts')) {
+ $table = $schema->createTable('accounts');
+ $table->addColumn('uid', 'string', [
+ 'notnull' => true,
+ 'length' => 64,
+ 'default' => '',
+ ]);
+ $table->addColumn('data', 'text', [
+ 'notnull' => true,
+ 'default' => '',
+ ]);
+ $table->setPrimaryKey(['uid']);
+ }
+
+ return $schema;
+ }
+
+ /**
+ * @param IOutput $output
+ * @param \Closure $schemaClosure The `\Closure` returns a `Schema`
+ * @param array $options
+ * @since 13.0.0
+ */
+ public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
+ }
+}