You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge #527: Fix DB migration for SQLite. Backup secondary tables to avoid losing data
094ab8a fix: linter errors (Jose Celano)
bd935b3 fix: [#526] DB migration for SQLite. Backup secondary tables (Jose Celano)
Pull request description:
The table `torrust_torrents` has 8 secondary tables that reference it with a foreign key:
```sql
FOREIGN KEY("torrent_id") REFERENCES "torrust_torrents"("torrent_id") ON DELETE CASCADE,
```
The migration fixed in this commit creates a new table in order to alter it and drops the old one. However, when you drop the old table, SQLite uses an implicit DELETE query for the `torrust_torrents` table which triggers a DELETE ON CASCADE, deleting all the related records in secondary tables.
The secondary tables are:
- torrust_torrent_files
- torrust_torrent_announce_urls
- torrust_torrent_info
- torrust_torrent_tracker_stats
- torrust_torrent_tag_links
- torrust_torrent_info_hashes
- torrust_torrent_http_seeds
- torrust_torrent_nodes
These tables store the torrent file fiel together with the master `torrust_torrents`.
ACKs for top commit:
josecelano:
ACK 094ab8a
Tree-SHA512: 631a40ac3645c67430831a681e04d91c0dc4a62efe9bb65036abb3bf992c1bb289b7af7ca3ca417c4cec0911a64c778b0e0fffedfe7dbf9f5ba1c8af28933f23
0 commit comments