Fix typo in previous migration using a new one
This commit is contained in:
parent
a9fcd70fb6
commit
5e20a5b7ce
3 changed files with 156 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
## 1.5.2 - 2022-08-24
|
||||||
|
### Fixed
|
||||||
|
- Typo in (database) Migrations kept Reader working for those who did not already have the correct table in their database
|
||||||
|
|
||||||
## 1.5.1 - 2022-08-24
|
## 1.5.1 - 2022-08-24
|
||||||
### Fixed
|
### Fixed
|
||||||
- Public pages also needed their plugin script changes, oops... fixed.
|
- Public pages also needed their plugin script changes, oops... fixed.
|
||||||
|
|
|
@ -30,7 +30,7 @@ See [README] for more exhaustive information on features and potential misfeatur
|
||||||
[README]: https://github.com/Yetangitu/owncloud-apps/blob/master/files_reader/README.md
|
[README]: https://github.com/Yetangitu/owncloud-apps/blob/master/files_reader/README.md
|
||||||
]]>
|
]]>
|
||||||
</description>
|
</description>
|
||||||
<version>1.5.1</version>
|
<version>1.5.2</version>
|
||||||
<licence>AGPL</licence>
|
<licence>AGPL</licence>
|
||||||
<author>Frank de Lange</author>
|
<author>Frank de Lange</author>
|
||||||
<documentation>
|
<documentation>
|
||||||
|
|
151
lib/Migration/Version015002Date20220924183940.php
Normal file
151
lib/Migration/Version015002Date20220924183940.php
Normal file
|
@ -0,0 +1,151 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace OCA\Files_Reader\Migration;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use OCP\DB\ISchemaWrapper;
|
||||||
|
use OCP\Migration\IOutput;
|
||||||
|
use OCP\Migration\SimpleMigrationStep;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated migration step
|
||||||
|
*/
|
||||||
|
class Version015002Date20220924183940 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) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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('reader_bookmarks')) {
|
||||||
|
$table = $schema->createTable('reader_bookmarks');
|
||||||
|
$table->addColumn('id', 'bigint', [
|
||||||
|
'autoincrement' => true,
|
||||||
|
'notnull' => true,
|
||||||
|
'length' => 8,
|
||||||
|
'unsigned' => true,
|
||||||
|
]);
|
||||||
|
// user ID, maps bookmark to NC/OC user
|
||||||
|
$table->addColumn('user_id', 'string', [
|
||||||
|
'notnull' => true,
|
||||||
|
'length' => 64,
|
||||||
|
'default' => '',
|
||||||
|
]);
|
||||||
|
// file ID, maps to NC/OC file ID
|
||||||
|
$table->addColumn('file_id', 'bigint', [
|
||||||
|
'notnull' => true,
|
||||||
|
'length' => 11,
|
||||||
|
'unsigned' => true,
|
||||||
|
]);
|
||||||
|
// type (bookmark, annotation, etc)
|
||||||
|
$table->addColumn('type', 'string', [
|
||||||
|
'notnull' => true,
|
||||||
|
'length' => 32,
|
||||||
|
'default' => '',
|
||||||
|
]);
|
||||||
|
$table->addColumn('name', 'string', [
|
||||||
|
'notnull' => true,
|
||||||
|
'length' => 512,
|
||||||
|
'default' => '',
|
||||||
|
]);
|
||||||
|
$table->addColumn('value', 'string', [
|
||||||
|
'notnull' => true,
|
||||||
|
'length' => 512,
|
||||||
|
'default' => '',
|
||||||
|
]);
|
||||||
|
$table->addColumn('content', 'string', [
|
||||||
|
'notnull' => false,
|
||||||
|
'length' => 4096,
|
||||||
|
]);
|
||||||
|
$table->addColumn('last_modified', 'bigint', [
|
||||||
|
'notnull' => false,
|
||||||
|
'length' => 8,
|
||||||
|
'default' => 0,
|
||||||
|
'unsigned' => true,
|
||||||
|
]);
|
||||||
|
$table->setPrimaryKey(['id']);
|
||||||
|
$table->addIndex(['file_id'], 'reader_bookmarks_file_id_index');
|
||||||
|
$table->addIndex(['user_id'], 'reader_bookmarks_user_id_index');
|
||||||
|
$table->addIndex(['name'], 'reader_bookmarks_name_index');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$schema->hasTable('reader_preferences')) {
|
||||||
|
$table = $schema->createTable('reader_preferences');
|
||||||
|
$table->addColumn('id', 'bigint', [
|
||||||
|
'autoincrement' => true,
|
||||||
|
'notnull' => true,
|
||||||
|
'length' => 8,
|
||||||
|
'unsigned' => true,
|
||||||
|
]);
|
||||||
|
// user ID, maps preference to NC/OC user
|
||||||
|
$table->addColumn('user_id', 'string', [
|
||||||
|
'notnull' => true,
|
||||||
|
'length' => 64,
|
||||||
|
'default' => '',
|
||||||
|
]);
|
||||||
|
// file ID, maps to NC/OC file ID
|
||||||
|
$table->addColumn('file_id', 'bigint', [
|
||||||
|
'notnull' => true,
|
||||||
|
'length' => 11,
|
||||||
|
'unsigned' => true,
|
||||||
|
]);
|
||||||
|
$table->addColumn('scope', 'string', [
|
||||||
|
'notnull' => true,
|
||||||
|
'length' => 32,
|
||||||
|
'default' => '',
|
||||||
|
]);
|
||||||
|
$table->addColumn('name', 'string', [
|
||||||
|
'notnull' => true,
|
||||||
|
'length' => 128,
|
||||||
|
'default' => '',
|
||||||
|
]);
|
||||||
|
$table->addColumn('value', 'string', [
|
||||||
|
'notnull' => true,
|
||||||
|
'length' => 4096,
|
||||||
|
'default' => '',
|
||||||
|
]);
|
||||||
|
$table->addColumn('last_modified', 'bigint', [
|
||||||
|
'notnull' => false,
|
||||||
|
'length' => 8,
|
||||||
|
'default' => 0,
|
||||||
|
'unsigned' => true,
|
||||||
|
]);
|
||||||
|
$table->setPrimaryKey(['id']);
|
||||||
|
$table->addIndex(['file_id'], 'reader_preferences_file_id_index');
|
||||||
|
$table->addIndex(['user_id'], 'reader_preferences_user_id_index');
|
||||||
|
$table->addIndex(['scope'], 'reader_preferences_scope_index');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($schema->hasTable('reader_prefs')) {
|
||||||
|
$table = $schema->getTable('reader_prefs');
|
||||||
|
$table->dropIndex('reader_prefs_file_id_index');
|
||||||
|
$table->dropIndex('reader_prefs_user_id_index');
|
||||||
|
$table->dropIndex('reader_prefs_scope_index');
|
||||||
|
$schema->dropTable('reader_prefs');
|
||||||
|
}
|
||||||
|
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) {
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue