Skip to content

Commit

Permalink
consolidated migration
Browse files Browse the repository at this point in the history
Signed-off-by: dartcafe <[email protected]>
  • Loading branch information
dartcafe committed Feb 16, 2024
1 parent 8efb7c9 commit eabdac0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 141 deletions.
1 change: 1 addition & 0 deletions lib/Migration/TableSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ abstract class TableSchema {
'040102Date20230123072601',
'050005Date20230506203301',
'050400Date20231011211203',
'050100Date20230515083001',
];

/**
Expand Down
137 changes: 0 additions & 137 deletions lib/Migration/Version050100Date20230515083001.php

This file was deleted.

19 changes: 15 additions & 4 deletions lib/Migration/Version060100Date20240209073304.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
namespace OCA\Polls\Migration;

use Doctrine\DBAL\Types\Type;
use OCA\Polls\Db\Poll;
use OCA\Polls\Db\TableManager;
use OCP\DB\ISchemaWrapper;
use OCP\IDBConnection;
Expand All @@ -42,7 +43,7 @@
*/
class Version060100Date20240209073304 extends SimpleMigrationStep {
private ISchemaWrapper $schema;

public function __construct(
private TableManager $tableManager,
private IDBConnection $connection,
Expand All @@ -63,6 +64,19 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op
return $this->schema;
}

/**
* @return void
*/
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
$now = time();
$query = $this->connection->getQueryBuilder();
$query->update(Poll::TABLE)
->set('last_interaction', $query->createNamedParameter($now))
->where($query->expr()->eq('last_interaction', $query->createNamedParameter(0)));
$query->executeStatement();
}


/**
* @return string[]
*
Expand Down Expand Up @@ -117,7 +131,4 @@ public function createTables(): array {
}
return $messages;
}



}

0 comments on commit eabdac0

Please sign in to comment.