diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-08-23 10:24:53 +0300 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-08-23 10:24:53 +0300 |
commit | 6427ae59b6d7f4785433e0fcf633444e8b202d1e (patch) | |
tree | d6dd15f38f9438179dcfdd0d6b9e08f963ce8234 | |
parent | 5a5c5220e6d472f76d33cd02518ff769ed35277e (diff) |
Move database over to migrations
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
-rw-r--r-- | appinfo/database.xml | 34 | ||||
-rw-r--r-- | appinfo/info.xml | 2 | ||||
-rw-r--r-- | composer/composer/autoload_classmap.php | 1 | ||||
-rw-r--r-- | composer/composer/autoload_static.php | 1 | ||||
-rw-r--r-- | lib/Command/PreGenerate.php | 40 | ||||
-rw-r--r-- | lib/Migration/Version020000Date20180823071939.php | 62 |
6 files changed, 85 insertions, 55 deletions
diff --git a/appinfo/database.xml b/appinfo/database.xml deleted file mode 100644 index 2e6697e..0000000 --- a/appinfo/database.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<database> - <name>*dbname*</name> - <create>true</create> - <overwrite>false</overwrite> - <charset>utf8</charset> - - <table> - <name>*dbprefix*preview_generation</name> - <declaration> - <field> - <name>id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <length>4</length> - </field> - - <field> - <name>uid</name> - <type>text</type> - <notnull>true</notnull> - <length>256</length> - </field> - <field> - <name>file_id</name> - <type>integer</type> - <notnull>true</notnull> - <length>4</length> - </field> - </declaration> - </table> -</database> diff --git a/appinfo/info.xml b/appinfo/info.xml index 5b47c7c..396593f 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -11,7 +11,7 @@ The app does not replace on demand preview generation so if a preview is request </description> <licence>AGPL</licence> <author>Roeland Jago Douma</author> - <version>1.99.0</version> + <version>1.99.1</version> <namespace>PreviewGenerator</namespace> <category>multimedia</category> <website>https://github.com/rullzer/previewgenerator</website> diff --git a/composer/composer/autoload_classmap.php b/composer/composer/autoload_classmap.php index 611141c..c3dffd5 100644 --- a/composer/composer/autoload_classmap.php +++ b/composer/composer/autoload_classmap.php @@ -11,6 +11,7 @@ return array( 'OCA\\PreviewGenerator\\Command\\Generate' => $baseDir . '/../lib/Command/Generate.php', 'OCA\\PreviewGenerator\\Command\\PreGenerate' => $baseDir . '/../lib/Command/PreGenerate.php', 'OCA\\PreviewGenerator\\Command\\TimestampFormatter' => $baseDir . '/../lib/Command/TimestampFormatter.php', + 'OCA\\PreviewGenerator\\Migration\\Version020000Date20180823071939' => $baseDir . '/../lib/Migration/Version020000Date20180823071939.php', 'OCA\\PreviewGenerator\\SizeHelper' => $baseDir . '/../lib/SizeHelper.php', 'OCA\\PreviewGenerator\\Watcher' => $baseDir . '/../lib/Watcher.php', ); diff --git a/composer/composer/autoload_static.php b/composer/composer/autoload_static.php index 713dba8..7fbab8e 100644 --- a/composer/composer/autoload_static.php +++ b/composer/composer/autoload_static.php @@ -26,6 +26,7 @@ class ComposerStaticInitPreviewGenerator 'OCA\\PreviewGenerator\\Command\\Generate' => __DIR__ . '/..' . '/../lib/Command/Generate.php', 'OCA\\PreviewGenerator\\Command\\PreGenerate' => __DIR__ . '/..' . '/../lib/Command/PreGenerate.php', 'OCA\\PreviewGenerator\\Command\\TimestampFormatter' => __DIR__ . '/..' . '/../lib/Command/TimestampFormatter.php', + 'OCA\\PreviewGenerator\\Migration\\Version020000Date20180823071939' => __DIR__ . '/..' . '/../lib/Migration/Version020000Date20180823071939.php', 'OCA\\PreviewGenerator\\SizeHelper' => __DIR__ . '/..' . '/../lib/SizeHelper.php', 'OCA\\PreviewGenerator\\Watcher' => __DIR__ . '/..' . '/../lib/Watcher.php', ); diff --git a/lib/Command/PreGenerate.php b/lib/Command/PreGenerate.php index aab90f0..05f0f3d 100644 --- a/lib/Command/PreGenerate.php +++ b/lib/Command/PreGenerate.php @@ -1,25 +1,25 @@ <?php /** - * @copyright Copyright (c) 2016, Roeland Jago Douma <roeland@famdouma.nl> - * - * @author Roeland Jago Douma <roeland@famdouma.nl> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ + * @copyright Copyright (c) 2016, Roeland Jago Douma <roeland@famdouma.nl> + * + * @author Roeland Jago Douma <roeland@famdouma.nl> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ namespace OCA\PreviewGenerator\Command; use OCA\PreviewGenerator\SizeHelper; diff --git a/lib/Migration/Version020000Date20180823071939.php b/lib/Migration/Version020000Date20180823071939.php new file mode 100644 index 0000000..7cebcd4 --- /dev/null +++ b/lib/Migration/Version020000Date20180823071939.php @@ -0,0 +1,62 @@ +<?php +declare(strict_types=1); +/** + * @copyright Copyright (c) 2016, Roeland Jago Douma <roeland@famdouma.nl> + * + * @author Roeland Jago Douma <roeland@famdouma.nl> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCA\PreviewGenerator\Migration; + +use OCP\DB\ISchemaWrapper; +use OCP\Migration\SimpleMigrationStep; +use OCP\Migration\IOutput; + +class Version020000Date20180823071939 extends SimpleMigrationStep { + + /** + * @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) { + /** @var ISchemaWrapper $schema */ + $schema = $schemaClosure(); + + if (!$schema->hasTable('preview_generation')) { + $table = $schema->createTable('preview_generation'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('uid', 'string', [ + 'notnull' => true, + 'length' => 256, + ]); + $table->addColumn('file_id', 'integer', [ + 'notnull' => true, + 'length' => 4, + ]); + $table->setPrimaryKey(['id']); + } + return $schema; + } +} |