Merge pull request #46644 from nextcloud/cast-bigint

fix: cast to bigint on postgresql
This commit is contained in:
Ferdinand Thiessen 2024-07-24 20:39:04 +02:00 committed by GitHub
commit 57ed738af2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 2 deletions

View file

@ -23,7 +23,7 @@ class PgSqlExpressionBuilder extends ExpressionBuilder {
public function castColumn($column, $type): IQueryFunction {
switch ($type) {
case IQueryBuilder::PARAM_INT:
return new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS INT)');
return new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS BIGINT)');
case IQueryBuilder::PARAM_STR:
return new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS TEXT)');
default:

View file

@ -72,6 +72,8 @@ class BackgroundCleanupJob extends TimedJob {
))
->where(
$qb->expr()->isNull('b.fileid')
)->andWhere(
$qb->expr()->eq('a.storage', $qb->createNamedParameter($this->previewFolder->getStorageId()))
)->andWhere(
$qb->expr()->eq('a.parent', $qb->createNamedParameter($this->previewFolder->getId()))
)->andWhere(

View file

@ -180,9 +180,11 @@ class BackgroundCleanupJobTest extends \Test\TestCase {
$f1->newFile('foo.jpg', 'foo');
$f2 = $appdata->newFolder('123456782');
$f2->newFile('foo.jpg', 'foo');
$f2 = $appdata->newFolder((string)PHP_INT_MAX - 1);
$f2->newFile('foo.jpg', 'foo');
$appdata = \OC::$server->getAppDataDir('preview');
$this->assertSame(2, count($appdata->getDirectoryListing()));
$this->assertSame(3, count($appdata->getDirectoryListing()));
$job = new BackgroundCleanupJob($this->timeFactory, $this->connection, $this->getRoot(), $this->mimeTypeLoader, true);
$job->run([]);