I have problem with primary key. I'm using Xamarin.Forms
PCL
project with SQLite-net
(1.4.118.0) NuGet library.
I forgot to add property with attributes PrimaryKey
, AutoIncrement
at the beginning.
Later i added primary key but it does not work (Id column has only "0" values).
It only works if i create new class with new name and PrimaryKey
, AutoIncrement
attributes.
How to recreate my table in Sqlite
from the scratch with original class name?
Where is table metadata stored in Sqlite
, how i can clean it?
public class ApproachViewModelNew
{
[SQLite.PrimaryKey, SQLite.AutoIncrement]
public int Id { get; set; }
public string ApproachName { get; set; }
public string ApproachDescription { get; set; }
}
After changing the structure of our tables, we gotta handle these changes by "Migration" process. Otherwise we gotta delete our database and create it again. You can delete app's DB by deleting App's cache in device settings