Commit graph

342 commits

Author SHA1 Message Date
Ferdinand Thiessen
2cabc708fb
fix(DB): Sanitize host parameter for postgres databases when IPv6 address is passed
Doctrine is using `pg_connect` with the `host` parameter, this does not allow IPv6 addresses in URI notation.
So we need to extract the IP address and pass it directly

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-03-25 23:55:04 +01:00
Joas Schilling
1412eedbc4 fix(migration): Make naming constraint fail softer on updates
Only on installation we want to break hard, so that all developers notice
the bugs when installing the app on any database or CI, and can work on
fixing their migrations before releasing a version incompatible with Postgres.

In case of updates we might be running on production instances and the
administrators being faced with the error would not know how to resolve it
anyway. This can also happen with instances, that had the issue before the
current update, so we don't want to make their life more complicated
than needed.

Signed-off-by: Joas Schilling <coding@schilljs.com>
2024-02-08 10:07:19 +00:00
Côme Chilliet
fc2467c18f Migrate missing primary key database check to new API
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-12-04 16:23:24 +00:00
Côme Chilliet
e48e67b0a4 Migrate missing index database check to new API
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-12-04 16:23:23 +00:00
Côme Chilliet
d0a72a103d Migrate missing column database check to new API
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-12-04 16:23:23 +00:00
Joas Schilling
aa5f037af7
chore: apply changes from Nextcloud coding standards 1.1.1
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
2023-11-23 10:36:13 +01:00
Arthur Schiwon
93505b2cdd fix(workflowengine): use andWhere() not second where()
- an unconditional where() condition is added right before
- fixes also wrongly named methods in the Exception message

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-11-13 14:47:47 +01:00
Joas Schilling
6f39d82031
fix(install): Make installing more verbose
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-11-03 15:44:46 +01:00
Joas Schilling
15a7aa51c5
fix(dbal): Fix types in query builder methods for parameters
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-10-18 07:09:08 +02:00
Joas Schilling
570159e610
fix(DB): Update comment to state why we still use the max 4k limit
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-10-06 15:29:27 +02:00
Joas Schilling
ccb01b19a0
fix(sqlite): Remove some old SQLite cheats
- Doctrine correctly forces integer for autoincrement by now
- Doctrine correctly maintains integer types by now

Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-10-06 15:29:27 +02:00
Joas Schilling
f8ee6c4769
fix(oracle): Move away from internal and deprecated SchemaDiff API
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-10-06 15:29:26 +02:00
Joas Schilling
919207873e
fix(dbal): Move migrator away from deprecated calls
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-10-06 15:29:26 +02:00
Joas Schilling
160298c556
fix(mysql): Remove custom MySQL workaround from 2015
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-10-06 15:29:25 +02:00
Joas Schilling
b202b139dd
fix(postgres): Remove old Postgres 9.4 workaround
Postgres 10 is the minimum in the meantime
and doctrine/dbal fixed this in 2.6.0 already
ref https://github.com/doctrine/dbal/pull/2614

Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-10-06 15:29:25 +02:00
Joas Schilling
ad839dbb0a
fix(sqlite): Remove no longer required autoincrement fix
- I installed current master and exported the schema as SQL
- Then I went to this branch, removed the content of the run() method (so made it no-op)
- I installed again and exported the schema as SQL
- The files are exactly the same, so whatever we tried to fix was fixed since 2015 in doctrine dbal

Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-10-06 15:29:25 +02:00
Hamid Dehnavi
ea06cf2f39 Convert isset ternary to null coalescing operator
Signed-off-by: Hamid Dehnavi <hamid.dev.pro@gmail.com>
2023-09-28 17:44:19 +03:30
Christoph Wurst
6b90ab1953
refactor: Use DBAL's executeQuery instead of query (deprecated)
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2023-09-27 10:43:42 +02:00
Robin Appelman
ef87ff1848
Merge pull request #39216 from shdehnavi/replace_substr_calls_in_lib_private
Refactor "substr" calls in lib/private to improve code readability
2023-09-21 16:34:27 +02:00
Anna Larch
56419d94f8 enh(db): provide database providers via API
To avoid leaking internals (OC), wrap the getDatabasePlatform and provide the
associated constants

fixes https://github.com/nextcloud/server/issues/30877

Signed-off-by: Anna Larch <anna@nextcloud.com>
2023-09-19 11:56:44 +02:00
Côme Chilliet
5c78adb20d
Fix Exception catching in OC\DB\Adapter
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-09-05 09:20:26 +02:00
Carl Schwan
e966cfbc4b
Cleanup plsam issues in DB/ContactsManager and Console
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2023-09-05 09:20:26 +02:00
Joas Schilling
0bf738d8cb
feat(db): Ensure that index names are unique across the database
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-07-20 14:27:26 +02:00
Hamid Dehnavi
d0b20534b9 Refactor "substr" calls to improve code readability
Signed-off-by: Hamid Dehnavi <hamid.dev.pro@gmail.com>
2023-07-07 04:54:20 +03:30
Christoph Wurst
14719110b9 chore: Replace \OC::$server->query with \OCP\Server::get in /lib
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2023-07-06 15:21:22 +02:00
dartcafe
2211721c2b
fixed quotes
Signed-off-by: dartcafe <github@dartcafe.de>
2023-06-20 18:35:10 +02:00
dartcafe
ed294f6e43
add type #38909
Signed-off-by: dartcafe <github@dartcafe.de>
2023-06-20 18:35:10 +02:00
Faraz Samapoor
e7cc7653b8 Refactors "strpos" calls in lib/private to improve code readability.
Signed-off-by: Faraz Samapoor <fsamapoor@gmail.com>
2023-05-15 15:17:19 +03:30
Julius Härtl
3bdd770129
fix: Check for wrapped retriable exceptions
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-05-02 19:42:11 +02:00
Côme Chilliet
426c0341ff
Use typed version of IConfig::getSystemValue as much as possible
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-04-05 12:50:08 +02:00
Arthur Schiwon
997c2a2a79
fix DBAL exception handling in setValues
This seems to be a left over after abstracting DBAL. Nowadays,
IQueryBuilder::executeStatement() only throws a \OCP\DB\Exception, where
previously original DBAL exceptions where thrown. These are now wrapped,
the orignal classes are now mapped to a reason.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-03-31 17:01:17 +02:00
Ferdinand Thiessen
a9af58fd1a fix(DB): Remove not supported column comments when using SQLite
Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
2023-02-22 01:07:26 +01:00
Robin Appelman
426b3429f7
log start time of queries for profiler
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-02-14 15:16:15 +01:00
Joas Schilling
ecad09b38a
Merge pull request #36261 from nextcloud/techdebt/noid/warn-devs-about-potential-bugs
fix(querybuilder): Log a warning if where() is called again on a quer…
2023-01-23 18:47:25 +01:00
Côme Chilliet
f5c361cf44
composer run cs:fix
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-01-20 11:45:08 +01:00
Joas Schilling
7f0a54c558
fix(querybuilder): Log a warning if where() is called again on a query builder object
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-01-20 07:41:19 +01:00
Côme Chilliet
8a16e7e8a1
Fix more psalm issues in OC\DB
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-11-21 11:30:20 +01:00
Côme Chilliet
378630f8a0
Fix psalm issues following doctrine/dbal bump
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-11-21 10:56:15 +01:00
Roeland Jago Douma
d151999fc8
typehint migrationservice closures
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2022-10-09 21:31:27 +02:00
Retidurc Silvernight
2269f35842
Change option name again to be more like the other options
Signed-off-by: Retidurc Silvernight <retidurc@silvernight.social>
2022-09-23 09:48:02 +02:00
Retidurc Silvernight
0de8729d7b
Change config option to db.persistent
Signed-off-by: Retidurc Silvernight <retidurc@silvernight.social>
2022-09-23 09:48:01 +02:00
Retidurc Silvernight
90f3379dfc
Expose Doctrine settings in Netxcloud settings
Signed-off-by: Retidurc Silvernight <retidurc@silvernight.social>
2022-09-23 09:47:56 +02:00
Côme Chilliet
4ac81733bd
Declare strict types in all new Event classes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-08-25 16:15:49 +02:00
Côme Chilliet
a2a7150d6d
Migrate Repair events to OCP\EventDispatcher\Event
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-08-25 16:15:48 +02:00
Côme Chilliet
a83a8f0dde
Migrate Migrator::executeSql to OCP\EventDispatcher\Event
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-08-25 16:13:47 +02:00
Côme Chilliet
4ba30d40cf
Switch to string keys for argument of GenericEvent for OC\DB\Migrator
It seems checkTable is actually never dispatched?

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-08-25 16:13:46 +02:00
Robin Appelman
6e0123a1d0 Revert "add case statement to sql function builder"
This reverts commit 2a68819a67.

Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-08-16 12:07:13 +02:00
Robin Appelman
9b52663a81 Revert "make expression build return IQueryFunction instead of string"
This reverts commit 813b50ed42.

Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-08-16 12:07:09 +02:00
luz paz
368f83095d Fix typos in lib/private subdirectory
Found via `codespell -q 3 -S l10n -L jus ./lib/private`

Signed-off-by: luz paz <luzpaz@github.com>
2022-07-27 08:52:17 -04:00
Côme Chilliet
c598e3cafa
composer run cs:fix
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-06-21 16:36:25 +02:00