autobrr/internal/database
soup ebbd851a2e
feat(autobrrctl): add db migrate/seed/reset functionality (#934)
* add db seed/reset functionality

* speculative db migration support

* update postgresSchema

* refactor: only migrate data, no schema

* implement transaction in db migration function

* refactor db:seed and db:reset

added transaction to both and updated help message

* change table order

* skip on foreign key constraint violations

* skip feed_cache

* set constraints to null

* fix seed and reset

* simplify migrate func

This version of the function should behave similarly to the previous version, but with less repetition and by relying on PostgreSQL's automatic transaction handling, which starts a new transaction for each separate statement when not in a transaction block. Also, it prepares the insert statement only once for each table, which can significantly improve performance when there are many rows to insert.

* fixed release_action_status

* refactor db:seed and db:reset

* minor adjustment to const usage

* fixed usage examples

* refactor seed/migrate

* refactor(database): seed and convert

* refactor(database): make tables list sorted a-z

* chore(deps): go mod tidy

* refactor(database): convert improve log output

---------

Co-authored-by: ze0s <ze0s@riseup.net>
2023-12-28 14:05:51 +01:00
..
tools feat(autobrrctl): add db migrate/seed/reset functionality (#934) 2023-12-28 14:05:51 +01:00
action.go feat(actions): qBittorrent add priority handling (#1315) 2023-12-25 22:39:31 +01:00
action_test.go refactor(http): auth handlers (#1311) 2023-12-28 02:04:25 +01:00
api.go chore: add LICENSE GPLv2-or-later (#897) 2023-05-01 16:21:59 +02:00
api_test.go refactor(http): auth handlers (#1311) 2023-12-28 02:04:25 +01:00
database.go feat(database): setup integration tests (#1118) 2023-11-18 20:04:30 +01:00
database_test.go refactor(http): auth handlers (#1311) 2023-12-28 02:04:25 +01:00
download_client.go feat(database): setup integration tests (#1118) 2023-11-18 20:04:30 +01:00
download_client_test.go refactor(http): auth handlers (#1311) 2023-12-28 02:04:25 +01:00
feed.go feat(database): setup integration tests (#1118) 2023-11-18 20:04:30 +01:00
feed_cache.go feat(database): setup integration tests (#1118) 2023-11-18 20:04:30 +01:00
feed_cache_test.go refactor(http): auth handlers (#1311) 2023-12-28 02:04:25 +01:00
feed_test.go refactor(http): auth handlers (#1311) 2023-12-28 02:04:25 +01:00
filter.go feat(filters): show enabled and disabled actions in list view (#1304) 2023-12-17 21:18:26 +01:00
filter_test.go refactor(http): auth handlers (#1311) 2023-12-28 02:04:25 +01:00
indexer.go fix(indexes): toggle on and off with switch (#1164) 2023-10-03 21:57:11 +02:00
indexer_test.go refactor(http): auth handlers (#1311) 2023-12-28 02:04:25 +01:00
irc.go feat(irc): support optional bot mode (#1246) 2023-11-22 19:57:16 +01:00
irc_test.go refactor(http): auth handlers (#1311) 2023-12-28 02:04:25 +01:00
notification.go feat(database): setup integration tests (#1118) 2023-11-18 20:04:30 +01:00
notification_test.go refactor(http): auth handlers (#1311) 2023-12-28 02:04:25 +01:00
postgres.go chore: add LICENSE GPLv2-or-later (#897) 2023-05-01 16:21:59 +02:00
postgres_migrate.go feat(actions): qBittorrent add priority handling (#1315) 2023-12-25 22:39:31 +01:00
release.go feat(web): link Dashboard stats to Releases page (#1281) 2023-12-25 14:03:29 +01:00
release_test.go refactor(http): auth handlers (#1311) 2023-12-28 02:04:25 +01:00
sqlite.go feat(database): setup integration tests (#1118) 2023-11-18 20:04:30 +01:00
sqlite_migrate.go feat(actions): qBittorrent add priority handling (#1315) 2023-12-25 22:39:31 +01:00
user.go feat(auth): change password and username (#1295) 2023-12-26 15:50:57 +01:00
user_test.go refactor(http): auth handlers (#1311) 2023-12-28 02:04:25 +01:00
utils.go chore: add LICENSE GPLv2-or-later (#897) 2023-05-01 16:21:59 +02:00
utils_test.go chore: add LICENSE GPLv2-or-later (#897) 2023-05-01 16:21:59 +02:00