OrchardCMS / Orchard

Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform.
https://orchardproject.net
BSD 3-Clause "New" or "Revised" License
2.37k stars 1.12k forks source link

Disabling and re-enabling AuditTrail module causes app restart #5477

Open dcinzona opened 9 years ago

dcinzona commented 9 years ago

I just encountered this issue where I had the Audit Trail module enabled previously, disabled it, redeployed the application, then enabled it again and the application crashed:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.Data.SqlClient.SqlException: There is already an object named 'Orchard_AuditTrail_AuditTrailEventRecord' in the database.

This issue only happened once (can't seem to repro) but will keep testing and still create this in case anyone else has seen it.

dcinzona commented 9 years ago

Whelp, I just was able to reproduce this... Happened a second time

Piedone commented 9 years ago

It seems that the first time the migration didn't run properly, so it created the table but for some reason there is no corresponding migration record (what causes migrations to be re-run, resulting in the error). Can you check whether the DataMigrationRecord table contains a record for Audit Trail?

dcinzona commented 9 years ago

It does 64 Orchard.AuditTrail.Migrations 2