cobbr / Covenant

Covenant is a collaborative .NET C2 framework for red teamers.
https://cobbr.io/Covenant.html
GNU General Public License v3.0
4.14k stars 766 forks source link

[Feature Request] Database Migrations #312

Open sbrun opened 3 years ago

sbrun commented 3 years ago

Feature Request Feature Request

Describe the feature request or bug After an update from version 0.5 to version 0.6, when we start covenant, it fails with an sqlite error.

If I understand correctly, you do not update the database. We need to remove the covenant.db to "fix" this.

To Reproduce

  1. Install version 0.5 (by installing dotnet core)
  2. Run covenant at least once to create the database
  3. Update covenant to version 0.6
  4. Run covenant
  5. An exception occurred while iterating over the results of a query for context type 'Covenant.Models.CovenantContext'. Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'no such table: Themes'.

Expected behavior There should be no need to delete the database. I think you should handle the db upgrade.

Target Information (System that implant is running on):

cobbr commented 3 years ago

@sbrun This is expected behavior, Covenant does not include database migrations for now, the database must be reset between version upgrades. Might look into that around the v1.0 timeframe.

cobbr commented 3 years ago

Will track this as a long-term feature request.

sbrun commented 3 years ago

I thought it was the desired behavior. Thanks for the confirmation. It would be a nice feature to have.

aancw commented 3 years ago

I've search about database migration feature for Razor and end up with this link: https://www.learnrazorpages.com/razor-pages/tutorial/bakery/migration

I hope it can help :)

cobbr commented 3 years ago

I'm sure EntityFrameworkCore has features for DB migration. But I'm not comfortable with the overhead this will create until we have at least reached a v1.0.