Skip to content

Commit

Permalink
Fix/v0.3.3 (#168)
Browse files Browse the repository at this point in the history
* fix(db): rewrite json specific query for postgres backends #162 (#167)

Signed-off-by: Florian Steffens <[email protected]>

* refactor(DI): replace DI method to get system configs

Signed-off-by: Florian Steffens <[email protected]>

* chore(release): bump version number and changelog

Signed-off-by: Florian Steffens <[email protected]>

---------

Signed-off-by: Florian Steffens <[email protected]>
  • Loading branch information
Florian authored Mar 20, 2023
1 parent 6d1fe24 commit bb70576
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.3.3 - 2023-03-20
### Updated
- Fix for deleting columns on postgres db backend #162
- Update dependencies
- Update translation

## 0.3.2 - 2023-03-15
### Updated
- Add hints for translation #152
Expand Down
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Share your tables with users and groups within your cloud.
Have a good time and manage whatever you want.
]]></description>
<version>0.3.2</version>
<version>0.3.3</version>
<licence>agpl</licence>
<author mail="[email protected]" >Florian Steffens</author>
<namespace>Tables</namespace>
Expand Down
4 changes: 2 additions & 2 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace OCA\Tables\AppInfo;

use OCP\Server;
use OCA\Tables\Listener\UserDeletedListener;
use OCA\Tables\Listener\AnalyticsDatasourceListener;
use OCA\Tables\Listener\TablesReferenceListener;
Expand Down Expand Up @@ -34,10 +35,9 @@ public function register(IRegistrationContext $context): void {

$context->registerSearchProvider(SearchTablesProvider::class);

$container = $this->getContainer();
try {
/** @var IConfig $config */
$config = $container->get(IConfig::class);
$config = Server::get(IConfig::class);
if (version_compare($config->getSystemValueString('version', '0.0.0'), '26.0.0', '<')) {
$context->registerReferenceProvider(TableReferenceProvider::class);
} else {
Expand Down
10 changes: 9 additions & 1 deletion lib/Db/RowMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,15 @@ public function findAllWithColumn(int $columnId): array {
$qb = $this->db->getQueryBuilder();
$qb->select('*')
->from($this->table);
$qb->where('JSON_CONTAINS(JSON_EXTRACT(data, \'$[*].columnId\'), :columnId, \'$\') = 1');

if (str_contains(strtolower(get_class($this->db->getDatabasePlatform())), 'postgres')) {
// due to errors using doctrine with json, I paste the columnId inline.
// columnId is a number, ensured by the parameter definition
$qb->where('data::jsonb @> \'[{"columnId": '.$columnId.'}]\'::jsonb');
} else {
$qb->where('JSON_CONTAINS(JSON_VALUE(data, \'$.columnId\'), :columnId, \'$\') = 1');
}

$qb->setParameter('columnId', $columnId);
return $this->findEntities($qb);
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tables",
"description": "Manage data within tables.",
"version": "0.3.2",
"version": "0.3.3",
"author": "Florian Steffens <[email protected]",
"bugs": {
"url": "https://github.com/nextcloud/tables/issues"
Expand Down

0 comments on commit bb70576

Please sign in to comment.