Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CarnetApp/CarnetNextcloud.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhie <phie@phie.ovh>2021-07-11 23:05:07 +0300
committerPhie <phie@phie.ovh>2021-07-11 23:05:07 +0300
commit3b1fb0c07e31c2587e6f1c61a007897d9a680925 (patch)
tree1cfe1de0cb0554eb2c8b4fdfbdad283e4ba71af8
parent76653f7ef84123d0acc1373fa0b361a2440b371a (diff)
migrate from database.xml to migration files
-rw-r--r--appinfo/database.xml40
-rw-r--r--lib/Migration/Version002401Date20210711195249.php64
2 files changed, 64 insertions, 40 deletions
diff --git a/appinfo/database.xml b/appinfo/database.xml
deleted file mode 100644
index 03f676b..0000000
--- a/appinfo/database.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<database>
- <name>*dbname*</name>
- <create>true</create>
- <overwrite>false</overwrite>
- <charset>utf8</charset>
- <table>
- <name>*dbprefix*carnet_metadata</name>
- <declaration>
- <field>
- <name>path</name>
- <type>text</type>
- <notnull>true</notnull>
- <length>191</length>
- </field>
- <index>
- <field>
- <name>path</name>
- </field>
- <name>indexpath</name>
- <unique>true</unique>
- </index>
- <field>
- <name>metadata</name>
- <type>text</type>
- <length>10000000</length>
-
- </field>
- <field>
- <name>last_modification_file</name>
- <type>integer</type>
- </field>
- <field>
- <name>low_case_text</name>
- <type>text</type>
- <length>10000000</length>
- </field>
- </declaration>
-</table>
-</database> \ No newline at end of file
diff --git a/lib/Migration/Version002401Date20210711195249.php b/lib/Migration/Version002401Date20210711195249.php
new file mode 100644
index 0000000..9e8c7eb
--- /dev/null
+++ b/lib/Migration/Version002401Date20210711195249.php
@@ -0,0 +1,64 @@
+<?php
+
+declare(strict_types=1);
+
+namespace OCA\Carnet\Migration;
+
+use Closure;
+use OCP\DB\ISchemaWrapper;
+use OCP\Migration\IOutput;
+use OCP\Migration\SimpleMigrationStep;
+
+/**
+ * Auto-generated migration step: Please modify to your needs!
+ */
+class Version002401Date20210711195249 extends SimpleMigrationStep {
+
+ /**
+ * @param IOutput $output
+ * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
+ * @param array $options
+ */
+ public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
+ }
+
+ /**
+ * @param IOutput $output
+ * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
+ * @param array $options
+ * @return null|ISchemaWrapper
+ */
+ public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
+ /** @var ISchemaWrapper $schema */
+ $schema = $schemaClosure();
+
+ if (!$schema->hasTable('carnet_metadata')) {
+ $table = $schema->createTable('carnet_metadata');
+ $table->addColumn('path', 'string', [
+ 'notnull' => true,
+ 'length' => 191,
+ ]);
+ $table->addColumn('metadata', 'string', [
+ 'notnull' => false,
+ 'length' => 10000000,
+ ]);
+ $table->addColumn('last_modification_file', 'integer', [
+ 'notnull' => false,
+ ]);
+ $table->addColumn('low_case_text', 'string', [
+ 'notnull' => false,
+ 'length' => 10000000,
+ ]);
+ $table->addUniqueIndex(['path'], 'indexpath');
+ }
+ return $schema;
+ }
+
+ /**
+ * @param IOutput $output
+ * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
+ * @param array $options
+ */
+ public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
+ }
+}