Commit graph

477 commits

Author SHA1 Message Date
provokateurin
83fbc64c99
fix(IResult): Use more accurate conditional return type for fetchAll
Signed-off-by: provokateurin <kate@provokateurin.de>
2026-02-11 08:50:13 +01:00
grnd-alt
bc5771b0ff fix: correctly quote tablenames for truncating with oracle
Signed-off-by: grnd-alt <git@belakkaf.net>
2026-02-10 22:48:02 +01:00
Andy Scherzinger
39ff32a33b
Merge pull request #58134 from nextcloud/carl/lock-propagator-order
fix(propagator): Improve lock behavior of propagator
2026-02-09 16:04:38 +01:00
Carl Schwan
f3778bc9c7
fix(propagator): Improve lock behavior of propagator
Fix possible dead locks when running the propagator caused by two
requests updating the same amount rows in transactions.

- Lock rows always in the same deterministic order by sorting the
  path_hash first

- On all database outside of sqlite, also do first a SELECT FOR UPDATE
  to lock all the rows used in batch UPDATE calls, afterward to decrease
  the risk of two requests trying to lock the same rows

Signed-off-by: Carl Schwan <carlschwan@kde.org>
2026-02-09 12:10:56 +01:00
provokateurin
f12cecb684
feat(rector): Enable SafeDeclareStrictTypesRector
Signed-off-by: provokateurin <kate@provokateurin.de>
2026-02-09 10:59:31 +01:00
Carl Schwan
65e769a861
refactor: Apply comments
Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
2026-02-06 13:50:46 +01:00
Carl Schwan
7b6078875b
refactor: Run rector on lib/private
Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
2026-02-06 13:50:18 +01:00
Carl Schwan
b4dfdf6492
refactor: Prefer using IFunctionBuilder than createFunction
Signed-off-by: Carl Schwan <carlschwan@kde.org>
2026-01-23 16:58:38 +01:00
Ferdinand Thiessen
67eef32b07
fix(DB): support up to 63 character long table and index names
We do not support Oracle 11 anymore but at least Oracle 12c (12.2).
So the limitation is gone (Oracle now supports up to 128 character long
names).

Instead we are now limited by MySQL (64 characters) and PostgreSQL (63
characters).

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2026-01-18 14:50:34 +01:00
Joas Schilling
6bc73b0dab
fix(PDO): Switch away from deprecated PDO parts
Signed-off-by: Joas Schilling <coding@schilljs.com>
2025-12-19 15:57:03 +01:00
Joas Schilling
69e6b6a483
fix(comments): Check comment object
Signed-off-by: Joas Schilling <coding@schilljs.com>
2025-12-11 07:55:55 +01:00
Tobias Kaminsky
6f0537b4e9
Merge pull request #56494 from nextcloud/carl/result-improv
Some checks are pending
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
Integration sqlite / changes (push) Waiting to run
Integration sqlite / integration-sqlite (master, 8.4, main, --tags ~@large files_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (master, 8.4, main, capabilities_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (master, 8.4, main, collaboration_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (master, 8.4, main, comments_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (master, 8.4, main, dav_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (master, 8.4, main, features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (master, 8.4, main, federation_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (master, 8.4, main, file_conversions) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (master, 8.4, main, files_reminders) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (master, 8.4, main, filesdrop_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (master, 8.4, main, ldap_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (master, 8.4, main, openldap_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (master, 8.4, main, openldap_numerical_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (master, 8.4, main, remoteapi_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (master, 8.4, main, routing_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (master, 8.4, main, setup_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (master, 8.4, main, sharees_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (master, 8.4, main, sharing_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (master, 8.4, main, theming_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (master, 8.4, main, videoverification_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite-summary (push) Blocked by required conditions
Psalm static code analysis / static-code-analysis (push) Waiting to run
Psalm static code analysis / static-code-analysis-security (push) Waiting to run
Psalm static code analysis / static-code-analysis-ocp (push) Waiting to run
Psalm static code analysis / static-code-analysis-ncu (push) Waiting to run
Improve IResult
2025-11-20 15:38:17 +01:00
Carl Schwan
3682dbbf5e feat(result): Update result wrapper with new doctrine methods
- fetch is replaced with fetchAssociative/fetchNumeric/fetchOne with
  better type hinting
- Same with fetchAll
- And add iterateAssociative/iterateNumeric which are nicer to use than
  a `while ($row = $result->fetch()) {}`

Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
2025-11-18 17:45:13 +01:00
Joas Schilling
60bfab2421
fix(db): Fix Oracle JSON handling
Signed-off-by: Joas Schilling <coding@schilljs.com>
2025-11-18 11:58:33 +01:00
Joas Schilling
4676b12a32
fix(db): Fix comparing JSON data in MySQL and MariaDB
Signed-off-by: Joas Schilling <coding@schilljs.com>
2025-11-18 11:58:32 +01:00
Joas Schilling
fb8caecbb0
fix(db): Fix JSON handling in WHERE statements for postgres
Signed-off-by: Joas Schilling <coding@schilljs.com>
2025-11-18 11:58:31 +01:00
Carl Schwan
336cc3fa35 feat(Db): Use SnowflakeId for previews
Allow to get an id for the storing the preview on disk before inserting
the preview on the DB.

Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
2025-10-28 17:50:03 +01:00
Carl Schwan
1dc363581f fix: get all available previews on Oracle
Split the DB requests in chunk of 1000 and use INNER JOIN instead of IN
as this is better supported on all DB.

Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
2025-10-23 14:10:15 +02:00
Carl Schwan
1eff9e5c90 feat(querybuilder): Remove deprecated IQueryBuilder::execute
This won't work when we update to doctrine DBAL 4 and all usages in
server were ported away.

Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
2025-10-13 17:02:04 +02:00
Carl Schwan
9095a36b94 refactor(dbal): Port away from getDatabasePlatform() instanceof pattern
Use getDatabaseProvider instead.

Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
2025-10-13 13:44:08 +02:00
Carl Schwan
7a43bf26ca refactor(dbal): Migrate away from Type::getName
Instead use Type::lookupName

Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
2025-10-10 16:13:09 +02:00
Carl Schwan
b0c6ef5821 refactor(dbal): Port away from deprecated hasPrimaryKey
Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
2025-10-10 15:44:43 +02:00
Benjamin Gaussorgues
5883914422
feat(db): add SSL/TLS support for PostgreSQL
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
2025-09-22 11:51:04 +02:00
Carl Schwan
837fe3586d feat(db): Restaure support for non-nullable boolean column
We disabled them because they are not supported on Oracle DB and it is
still the case for OCI < 23. But instead of disabling the support
completely for every database types, mark non-nullable boolean column as
actually nullable when using Oracle.

This allow to use some slighly lighter schema on normal databases who
support natively booleans wheen we don't need to store 3 states
true|false|null.

Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
2025-09-17 14:45:48 +02:00
Carl Schwan
c21b8169ff refactor(querybuilder): Port away from qb::execute() in lib/
Replace by either executeStatement or executeQuery

Signed-off-by: Carl Schwan <carl.schwan@nextclound.com>
2025-09-02 11:55:56 +02:00
Côme Chilliet
b7c15949ce
chore: Get rid of AppLocator helper
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-08-18 17:09:40 +02:00
Varun Patil
5ecd3c4b49
feat(database): Add option to test for mariadb
There are some behavioral differences that apps may need to check for.
See discussion on #51175 for more info.

This preserves the existing behavior of getDatabaseProvider()

Signed-off-by: Varun Patil <varunpatil@ucla.edu>
2025-08-08 07:50:51 +02:00
Joas Schilling
c9fa1db925
Merge pull request #54230 from nextcloud/bugfix/spreed-15625/log-query-with-immutable-dates
fix(logging): Fix query logging with DateTimeImmutable parameters
2025-08-05 12:29:04 +02:00
Joas Schilling
c722f8c88b
fix(logging): Fix query logging with DateTimeImmutable parameters
Signed-off-by: Joas Schilling <coding@schilljs.com>
2025-08-04 08:47:55 +02:00
Robin Appelman
222cbd0af6
fix: fix oci string length with empty strings
Signed-off-by: Robin Appelman <robin@icewind.nl>
2025-08-01 17:45:35 +02:00
Marcel Klehr
8589debf6d fix(ConnectionFactory): Apply Oracle connection fix to primary and replica params as well
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2025-07-21 15:49:40 +02:00
Ferdinand Thiessen
5981b7eb51
chore: apply new CSFixer rules
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>

# Conflicts:
#	apps/settings/lib/SetupChecks/PhpOpcacheSetup.php
2025-07-01 16:26:50 +02:00
Robin Appelman
26903926a2
fix: allow hinting the shard keys for joined tables
Signed-off-by: Robin Appelman <robin@icewind.nl>
2025-06-10 16:15:05 +02:00
Joas Schilling
ad7a050f96
fix: Revert "fix(db): Store last insert id before reconnect"
This reverts commit df94cceb7b.
There were records of some old IDs being read which is much worse

Signed-off-by: Joas Schilling <coding@schilljs.com>
2025-05-21 07:55:42 +02:00
Joas Schilling
df94cceb7b
fix(db): Store last insert id before reconnect
During a reconnect we are losing the connection and when the
realLastInsertId call is the one triggering the reconnect, it
does not return the ID. But inside the reconnect, we were able
to save the last insert id, so calling it a second time is going
to be successful.
We can not return the result on the initial call, as we are already
way deeper in the stack performing the actual database query on
the doctrine driver.

Signed-off-by: Joas Schilling <coding@schilljs.com>
2025-05-14 10:27:00 +02:00
Marcel Müller
0955b0a39d feat: Add option to also log parameters to query log
Signed-off-by: Marcel Müller <marcel-mueller@gmx.de>
2025-04-19 21:29:26 +02:00
Robin Appelman
fc2cda12b5
fix: use proper migration sorting when checking if a migration needs to be executed
Signed-off-by: Robin Appelman <robin@icewind.nl>
2025-04-02 14:29:08 +02:00
Robin Appelman
9bbe8c59d7
Merge pull request #51073 from nextcloud/dbal-exception-query
feat: log query for dbal exceptions
2025-03-04 16:32:55 +01:00
Varun Patil
c414ddee54 feat(db): add truncateTable method
Signed-off-by: Varun Patil <varunpatil@ucla.edu>
2025-03-02 10:36:13 -08:00
Robin Appelman
f3bd4a79d9
feat: log query for dbal exceptions
Signed-off-by: Robin Appelman <robin@icewind.nl>
2025-02-26 17:37:13 +01:00
Andy Scherzinger
48d69c727a
fix(lint): correct comment identation
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2025-02-25 22:35:50 +01:00
Andy Scherzinger
388301275b
Merge pull request #50764 from p1gp1g/patch-1
Update doc comment for prefixTableName
2025-02-25 22:16:04 +01:00
Robin Appelman
0a77ba99a2
feat: support migrating an instance to sharding
Signed-off-by: Robin Appelman <robin@icewind.nl>
2025-02-25 17:52:40 +01:00
Louis Chemineau
066c92f7b0 fix: Initialize lastConnectionCheck after first connection
We are checking whether the DB connection is alive once every 30 seconds. But when we are lacking the last check time, we are skipping the check and reconnect logic. This is causing the reconnect logic to never fire in those cases.

It seems to me that "those cases", are actually always the case, as upon initialization, we are not using the proper connection name to store the time.

In the `connect()` logic, when `$this->_conn` is null, `$this->getConnectionName()` is returning `replica`, so `$this->lastConnectionCheck` will be equal to `['replica' => time()];`

60711ea4cf/lib/private/DB/Connection.php (L215-L221)

60711ea4cf/lib/private/DB/Connection.php (L891-L893)

2b6d7bf65f/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php (L136-L139)

Then, if the connection name ends up as being 'primary', the reconnect logic is skipped:

60711ea4cf/lib/private/DB/Connection.php (L874-L880)

Follow-up of https://github.com/nextcloud/server/pull/41819

Signed-off-by: Louis Chemineau <louis@chmn.me>
2025-02-19 12:25:12 +01:00
S1m
da090c7a7a
Update doc comment for prefixTableName
Signed-off-by: S1m <31284753+p1gp1g@users.noreply.github.com>
2025-02-11 17:44:39 +01:00
Nils Wenninghoff
cf5d55edb7
fix(ConvertType): Read dbtype in createConnectionParams and remove safeguard
Signed-off-by: Nils Wenninghoff <nils@ungemein.cool>
2025-01-30 09:24:58 +01:00
Robin Appelman
0f55a589ba
fix: improve logic for ensuring join columns are selected for partitioned queries
Signed-off-by: Robin Appelman <robin@icewind.nl>
2024-12-12 17:39:04 +01:00
Robin Appelman
c3930163a2
fix: handle calling select on partitioned queries with an array of columns
Signed-off-by: Robin Appelman <robin@icewind.nl>
2024-12-12 17:38:21 +01:00
Benjamin Gaussorgues
49bd1754d4 fix(sharding): typo in addOrderBy
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
2024-10-30 07:53:10 +01:00
dependabot[bot]
bb598c8451
chore(deps): Bump nextcloud/coding-standard in /vendor-bin/cs-fixer
Bumps [nextcloud/coding-standard](https://github.com/nextcloud/coding-standard) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/nextcloud/coding-standard/releases)
- [Changelog](https://github.com/nextcloud/coding-standard/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nextcloud/coding-standard/compare/v1.3.1...v1.3.2)

---
updated-dependencies:
- dependency-name: nextcloud/coding-standard
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-10-19 07:57:35 +02:00