diff options
author | Phie <phie@phie.ovh> | 2021-07-11 23:05:07 +0300 |
---|---|---|
committer | Phie <phie@phie.ovh> | 2021-07-11 23:05:07 +0300 |
commit | 3b1fb0c07e31c2587e6f1c61a007897d9a680925 (patch) | |
tree | 1cfe1de0cb0554eb2c8b4fdfbdad283e4ba71af8 /lib | |
parent | 76653f7ef84123d0acc1373fa0b361a2440b371a (diff) |
migrate from database.xml to migration files
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Migration/Version002401Date20210711195249.php | 64 |
1 files changed, 64 insertions, 0 deletions
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 { + } +} |