migrate therinaldos.com data
Build & Deploy to DigitalOcean Space / build (push) Failing after 2m38s

This commit is contained in:
2024-05-05 15:50:45 -04:00
commit ef1ff240d4
23182 changed files with 3801898 additions and 0 deletions
@@ -0,0 +1,57 @@
<?php
namespace OCA\Text\Migration;
use OCA\Text\Db\SessionMapper;
use OCA\Text\Service\DocumentService;
use OCP\IConfig;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
class ResetSessionsBeforeYjs implements IRepairStep {
private IConfig $config;
private SessionMapper $sessionMapper;
private DocumentService $documentService;
public function __construct(IConfig $config,
SessionMapper $sessionMapper,
DocumentService $documentService) {
$this->config = $config;
$this->sessionMapper = $sessionMapper;
$this->documentService = $documentService;
}
/**
* @return string
*/
public function getName(): string {
return 'Force-reset all Text sessions before Yjs migration';
}
/**
* @param IOutput $output
*
* @return void
*/
public function run(IOutput $output): void {
$appVersion = $this->config->getAppValue('text', 'installed_version');
if (!$appVersion || version_compare($appVersion, '3.7.2') !== -1) {
return;
}
$sessions = $this->sessionMapper->findAllDocuments();
if (!$sessions) {
return;
}
$output->startProgress(count($sessions));
foreach ($sessions as $session) {
$documentId = $session->getDocumentId();
$this->documentService->unlock($documentId);
$this->documentService->resetDocument($documentId, true);
$output->advance();
}
$output->finishProgress();
}
}
@@ -0,0 +1,149 @@
<?php
declare(strict_types=1);
namespace OCA\Text\Migration;
use Closure;
use Doctrine\DBAL\Types\Types;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
/**
* Auto-generated migration step: Please modify to your needs!
*/
class Version010000Date20190617184535 extends SimpleMigrationStep {
/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
*
* @return void
*/
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('text_documents')) {
$table = $schema->createTable('text_documents');
$table->addColumn('id', Types::BIGINT, [
'autoincrement' => true,
'notnull' => true,
'unsigned' => true,
]);
$table->addColumn('current_version', Types::BIGINT, [
'notnull' => true,
'default' => 0,
'unsigned' => true,
]);
$table->addColumn('last_saved_version', Types::BIGINT, [
'notnull' => true,
'default' => 0,
'unsigned' => true,
]);
$table->addColumn('last_saved_version_time', Types::BIGINT, [
'notnull' => true,
'length' => 20,
'unsigned' => true,
]);
$table->addColumn('last_saved_version_etag', Types::STRING, [
'notnull' => false,
'length' => 64,
'default' => ''
]);
$table->addColumn('base_version_etag', Types::STRING, [
'notnull' => false,
'length' => 64,
'default' => ''
]);
$table->setPrimaryKey(['id']);
}
if (!$schema->hasTable('text_sessions')) {
$table = $schema->createTable('text_sessions');
$table->addColumn('id', Types::BIGINT, [
'autoincrement' => true,
'notnull' => true,
'unsigned' => true,
]);
$table->addColumn('user_id', Types::STRING, [
'notnull' => false,
'length' => 64,
]);
$table->addColumn('guest_name', Types::STRING, [
'notnull' => false,
'length' => 64,
]);
$table->addColumn('color', Types::STRING, [
'notnull' => false,
'length' => 7,
]);
$table->addColumn('token', Types::STRING, [
'notnull' => true,
'length' => 64,
]);
$table->addColumn('document_id', Types::BIGINT, [
'notnull' => true,
]);
$table->addColumn('last_contact', Types::BIGINT, [
'notnull' => true,
'length' => 20,
'unsigned' => true,
]);
$table->setPrimaryKey(['id']);
$table->addIndex(['token'], 'rd_session_token_idx');
$table->addIndex(['last_contact'], 'ts_lastcontact');
}
if (!$schema->hasTable('text_steps')) {
$table = $schema->createTable('text_steps');
$table->addColumn('id', Types::BIGINT, [
'autoincrement' => true,
'notnull' => true,
'unsigned' => true,
]);
$table->addColumn('document_id', Types::BIGINT, [
'notnull' => true,
'unsigned' => true,
]);
$table->addColumn('session_id', Types::BIGINT, [
'notnull' => true,
'unsigned' => true,
]);
$table->addColumn('data', Types::TEXT, [
'notnull' => true,
]);
$table->addColumn('version', Types::BIGINT, [
'notnull' => true,
'default' => 0,
'unsigned' => true,
]);
$table->setPrimaryKey(['id']);
$table->addIndex(['document_id'], 'rd_steps_did_idx');
$table->addIndex(['version'], 'rd_steps_version_idx');
$table->addIndex(['session_id'], 'textstep_session');
}
return $schema;
}
/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
*
* @return void
*/
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
}
}
@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace OCA\Text\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 Version030001Date20200402075029 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();
$table = $schema->getTable('text_sessions');
$table->addIndex([
'document_id',
'last_contact',
], 'ts_docid_lastcontact');
return $schema;
}
}
@@ -0,0 +1,59 @@
<?php
declare(strict_types=1);
namespace OCA\Text\Migration;
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\IConfig;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
class Version030201Date20201116110353 extends SimpleMigrationStep {
/** @var bool */
private $isOracle;
public function __construct(IConfig $config) {
$this->isOracle = $config->getSystemValue('dbtype', 'sqlite') === 'oci';
}
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
$this->ensureColumnIsNullable($schema, 'text_steps', 'version');
if ($this->isOracle) {
// Drop table if we are on oracle and recreate it with the next migration Version030201Date20201116123153
if ($schema->hasTable('text_documents')) {
$schema->dropTable('text_documents');
}
} else {
$this->ensureColumnIsNullable($schema, 'text_documents', 'current_version');
$this->ensureColumnIsNullable($schema, 'text_documents', 'last_saved_version');
$table = $schema->getTable('text_documents');
$column = $table->getColumn('id');
if ($column->getAutoincrement()) {
$table->changeColumn('id', [
'autoincrement' => false,
]);
}
}
return $schema;
}
protected function ensureColumnIsNullable(ISchemaWrapper $schema, string $tableName, string $columnName): bool {
$table = $schema->getTable($tableName);
$column = $table->getColumn($columnName);
if ($column->getNotnull()) {
$column->setNotnull(false);
return true;
}
return false;
}
}
@@ -0,0 +1,69 @@
<?php
declare(strict_types=1);
namespace OCA\Text\Migration;
use Closure;
use Doctrine\DBAL\Types\Types;
use OCP\DB\ISchemaWrapper;
use OCP\IConfig;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
class Version030201Date20201116123153 extends SimpleMigrationStep {
/** @var bool */
private $isOracle;
public function __construct(IConfig $config) {
$this->isOracle = $config->getSystemValue('dbtype', 'sqlite') === 'oci';
}
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
if (!$this->isOracle) {
return null;
}
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
if (!$schema->hasTable('text_documents')) {
// Recreate table from the first migration since we cannot alter the autoincrement on the id column with oracle
$table = $schema->createTable('text_documents');
$table->addColumn('id', Types::BIGINT, [
'notnull' => true,
'unsigned' => true,
]);
$table->addColumn('current_version', Types::BIGINT, [
// 'notnull' => true,
'notnull' => false,
'default' => 0,
'unsigned' => true,
]);
$table->addColumn('last_saved_version', Types::BIGINT, [
// 'notnull' => true,
'notnull' => false,
'default' => 0,
'unsigned' => true,
]);
$table->addColumn('last_saved_version_time', Types::BIGINT, [
'length' => 20,
'unsigned' => true,
]);
$table->addColumn('last_saved_version_etag', Types::STRING, [
'notnull' => false,
'length' => 64,
'default' => ''
]);
$table->addColumn('base_version_etag', Types::STRING, [
'notnull' => false,
'length' => 64,
'default' => ''
]);
$table->setPrimaryKey(['id']);
return $schema;
}
return null;
}
}
@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace OCA\Text\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 Version030501Date20220202101853 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();
$table = $schema->getTable('text_sessions');
if (!$table->hasIndex('ts_lastcontact')) {
$table->addIndex(['last_contact'], 'ts_lastcontact');
return $schema;
}
return null;
}
}
@@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
namespace OCA\Text\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 Version030701Date20230207131313 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();
$table = $schema->getTable('text_sessions');
if (!$table->hasColumn('last_awareness_message')) {
$table->addColumn('last_awareness_message', \OCP\DB\Types::TEXT, [
'notnull' => false,
'default' => ''
]);
return $schema;
}
return null;
}
}
@@ -0,0 +1,46 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2023 Julius Härtl <jus@bitgrid.net>
*
* @authorJulius Härtl <jus@bitgrid.net>
*
* @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\Text\Migration;
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
class Version030901Date20231114150437 extends SimpleMigrationStep {
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
$schema = $schemaClosure();
if ($schema->hasTable('text_steps')) {
$table = $schema->getTable('text_steps');
if ($table->hasIndex('ts_session')) {
$table->dropIndex('ts_session');
return $schema;
}
}
return null;
}
}