Skip to content

Commit 06b93ef

Browse files
committed
#16: Refactoring of the "IsSameModel"-method.
1 parent b73f578 commit 06b93ef

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

SQLite.CodeFirst/DbInitializers/SqliteDropCreateDatabaseWhenModelChanges.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,18 @@ private void SaveHistory(TContext context)
121121

122122
private bool IsSameModel(TContext context)
123123
{
124+
125+
var hash = GetHashFromModel(context.Database.Connection);
126+
124127
try
125128
{
126-
var hash = GetHashFromModel(context.Database.Connection);
127129
var history = GetHistoryRecord(context);
128130
return history?.Hash == hash;
129131
}
130132
catch (Exception)
131133
{
134+
// This happens if the history table does not exist.
135+
// So it covers also the case with a null byte file (see SqliteCreateDatabaseIfNotExists).
132136
return false;
133137
}
134138
}

0 commit comments

Comments
 (0)