summaryrefslogtreecommitdiffstats
path: root/lib/private/db/pgsqltools.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/db/pgsqltools.php')
-rw-r--r--lib/private/db/pgsqltools.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/private/db/pgsqltools.php b/lib/private/db/pgsqltools.php
index c3ac140594d..f3204d4c7b6 100644
--- a/lib/private/db/pgsqltools.php
+++ b/lib/private/db/pgsqltools.php
@@ -8,11 +8,23 @@
*/
namespace OC\DB;
+use OCP\IConfig;
/**
* Various PostgreSQL specific helper functions.
*/
class PgSqlTools {
+
+ /** @var \OCP\IConfig */
+ private $config;
+
+ /**
+ * @param \OCP\IConfig $config
+ */
+ public function __construct(IConfig $config) {
+ $this->config = $config;
+ }
+
/**
* @brief Resynchronizes all sequences of a database after using INSERTs
* without leaving out the auto-incremented column.
@@ -21,6 +33,9 @@ class PgSqlTools {
*/
public function resynchronizeDatabaseSequences(Connection $conn) {
$databaseName = $conn->getDatabase();
+ $conn->getConfiguration()->
+ setFilterSchemaAssetsExpression('/^' . $this->config->getSystemValue('dbtableprefix', 'oc_') . '/');
+
foreach ($conn->getSchemaManager()->listSequences() as $sequence) {
$sequenceName = $sequence->getName();
$sqlInfo = 'SELECT table_schema, table_name, column_name