Remove 0.3 upgrade script.

Implement Clear Unassigned Card method to remove all cards/identifiers from the database not assigned to a user.
Add procedure to delete cards from the db.
#69
This commit is contained in:
Chris.Watts90@outlook.com 2018-03-07 09:01:02 +00:00
parent 7a27bba95e
commit b266fbf8e0
3 changed files with 10 additions and 4 deletions

View File

@ -63,6 +63,9 @@ namespace SQLiteRepository
public const string GET_UNASSIGNED_CARD_LIST =
"select * from " + nameof(CardUniqueId) + " where " + nameof(CardUniqueId.UserId_FK) + "=?";
public const string CLEAR_UNASSIGNED_CARDS =
"delete from " + nameof(CardUniqueId) + " where " + nameof(CardUniqueId.UserId_FK) + "=?";
public const string UPDATE_CARD_USER_ID =
"update " + nameof(CardUniqueId) + " set " + nameof(CardUniqueId.UserId_FK) + "=? where " +
nameof(CardUniqueId.Id) + "=?";

View File

@ -309,6 +309,13 @@ namespace SQLiteRepository
return ret;
}
public void ClearUnassignedIdentifiers()
{
_connection.Execute(
SQLiteProcedures.CLEAR_UNASSIGNED_CARDS,
Constants.UNASSIGNED_CARD_USER_ID);
}
//TODO: Check time logs table on update to ensure associated cards/unique identifiers are removed/added as appropriate.
public OperationResponse UpdateUser(User user, out int userIdResult)
{

View File

@ -77,7 +77,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyVersionInfo.cs" />
<Compile Include="CardUniqueId.cs" />
<Compile Include="DBVersion.cs" />
<Compile Include="GroupDb.cs" />
@ -107,9 +106,6 @@
<ItemGroup>
<EmbeddedResource Include="UpgradeScripts\0.2.sql" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="UpgradeScripts\0.3.sql" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\System.Data.SQLite.Core.1.0.104.0\build\net451\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.104.0\build\net451\System.Data.SQLite.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">