/*
* Generated by Robotoworks Mechanoid
*/
package com.robotoworks.example.ghissues.db;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import com.robotoworks.mechanoid.db.MechanoidSQLiteOpenHelper;
import com.robotoworks.mechanoid.db.SQLiteMigration;
import com.robotoworks.example.ghissues.db.migrations.DefaultGithubDBMigrationV1;
import com.robotoworks.example.ghissues.db.migrations.DefaultGithubDBMigrationV2;
public abstract class AbstractGithubDBOpenHelper extends MechanoidSQLiteOpenHelper {
private static final String DATABASE_NAME = "GithubDB.db";
public static final int VERSION = 2;
public interface Sources {
String ISSUES = "issues";
}
public AbstractGithubDBOpenHelper(Context context) {
super(context, DATABASE_NAME, null, VERSION);
}
public AbstractGithubDBOpenHelper(Context context, String name) {
super(context, name, null, VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
applyMigrations(db, 0, VERSION);
}
@Override
protected SQLiteMigration createMigration(int version) {
switch(version) {
case 0:
return createGithubDBMigrationV1();
case 1:
return createGithubDBMigrationV2();
default:
throw new IllegalStateException("No migration for version " + version);
}
}
protected SQLiteMigration createGithubDBMigrationV1() {
return new DefaultGithubDBMigrationV1();
}
protected SQLiteMigration createGithubDBMigrationV2() {
return new DefaultGithubDBMigrationV2();
}
}