I have a database class in java where i'm trying to create a new table in sqlite. Tables get created when the app compiles but for some reason when i add a new line to add a new table it doesn't get created. My db class looks like this:
public static final String DATABASE_NAME = "something_db";
private Lock writeLock;
private boolean locked;
private DataBase(Context context)
{
super(context, DATABASE_NAME, null, DATABASE_VERSION);
writeLock = new ReentrantLock();
}
@Override
public void onCreate(SQLiteDatabase db)
{
onCreateV1(db);
onCreateV2(db);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
{
if(oldVersion == 1 && newVersion == 2)
{
onCreateV2(db);
}
}
private void onCreateV1(SQLiteDatabase db)
{
db.execSQL("create table schedule (id integer, day integer, start text, end text, points double, unique(id) on conflict replace)");
db.execSQL("create table zone(id integer, name text, imageUrl text, imageFileName text, points double, unique(id) on conflict replace)");
db.execSQL("create table zoneLocation(zoneId integer, locationOrder integer, latitude double, longitude double, unique(zoneId, locationOrder) on conflict replace)");
db.execSQL("create table userLocation(id integer primary key, timestamp integer, latitude double, longitude double, speed double)");
db.execSQL("create table userPoint(id integer primary key, timestamp text, scheduleId integer, scheduleMultiplier double, speedRangeId integer, speedRangeMultiplier double, zoneId integer, zoneMultiplier double, latitude double, longitude double, total double, sent integer)");
db.execSQL("create table userTransaction(userId integer, date text, points double, unique(userId, date) on conflict replace)");
db.execSQL("create table speedRange(id integer, name text, lowerLimit double, points double, unique(id) on conflict replace)");
I tried adding a new line to create a new table but every time i compile the app it tells me
E/SQLiteLog: (1) no such table: UserTopChallengers
Shouldn't just be adding the line along the others table being created should be enough? Why is the table i added not being created with the others.