mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-29 13:53:54 +01:00
Merge "commons" into the project root directory
This commit is contained in:
parent
d42db0612e
commit
b4231bbfdc
324 changed files with 22 additions and 23 deletions
40
app/src/main/java/fr/free/nrw/commons/data/DBOpenHelper.java
Normal file
40
app/src/main/java/fr/free/nrw/commons/data/DBOpenHelper.java
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
package fr.free.nrw.commons.data;
|
||||
|
||||
import android.content.*;
|
||||
import android.database.sqlite.*;
|
||||
|
||||
import fr.free.nrw.commons.modifications.ModifierSequence;
|
||||
import fr.free.nrw.commons.category.Category;
|
||||
import fr.free.nrw.commons.contributions.*;
|
||||
|
||||
public class DBOpenHelper extends SQLiteOpenHelper{
|
||||
|
||||
private static final String DATABASE_NAME = "commons.db";
|
||||
private static final int DATABASE_VERSION = 6;
|
||||
private static DBOpenHelper singleton = null;
|
||||
|
||||
public static synchronized DBOpenHelper getInstance(Context context) {
|
||||
if ( singleton == null ) {
|
||||
singleton = new DBOpenHelper(context);
|
||||
}
|
||||
return singleton;
|
||||
}
|
||||
|
||||
private DBOpenHelper(Context context) {
|
||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase sqLiteDatabase) {
|
||||
Contribution.Table.onCreate(sqLiteDatabase);
|
||||
ModifierSequence.Table.onCreate(sqLiteDatabase);
|
||||
Category.Table.onCreate(sqLiteDatabase);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int from, int to) {
|
||||
Contribution.Table.onUpdate(sqLiteDatabase, from, to);
|
||||
ModifierSequence.Table.onUpdate(sqLiteDatabase, from, to);
|
||||
Category.Table.onUpdate(sqLiteDatabase, from, to);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue