Skip to content

Missing tables in Database::delete_all_database_rows #194

@josecelano

Description

@josecelano

There is a function to clean the database table records. It's used only for testing. It deletes all records from all tables. Since it's maintained manually, there are some missing tables:

All tables:

torrust_categories
torrust_torrent_announce_urls <- missing
torrust_torrent_files         <- missing
torrust_torrent_info          <- missing
torrust_torrent_tag_links     <- missing
torrust_torrent_tags          <- missing
torrust_torrent_tracker_stats <- missing
torrust_torrents
torrust_tracker_keys
torrust_user_authentication
torrust_user_bans
torrust_user_invitation_uses  <- missing
torrust_user_invitations
torrust_user_profiles
torrust_user_public_keys
torrust_users

Tables in delete_all_database_rows function:

torrust_categories
torrust_torrents
torrust_tracker_keys
torrust_user_authentication
torrust_user_bans
torrust_user_invitations
torrust_user_profiles
torrust_user_public_keys
torrust_users

We could at least query the DB to get the table list to check that we are not missing any. They have to be truncated in a certain order to avoid contains with foreign keys.

We could only consider using a new empty database for testing instead of truncating the tables. I think this is only used for the database tests with MySQL because it always uses the same DB. Maybe we can change that.

It's not a problem yet because it's only used for testing and the tests would fail if they require an empty table. And we are only using SQLite for unit testing when a new clean DB for each test. It could be a problem if you try to run E2E tests with a shared instance using MySQL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EasyGood for Newcomers

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions