package beatprogramming.github.com.teacker_tracker;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;


public class BDHelper extends SQLiteOpenHelper {

    private static final String DATABASE_NAME = "TEACHER_TRACKER.db";
    private static final int DATABASE_VERSION = 1;

    private static BDHelper bdHelper;

    public BDHelper(Context context) {
        super(context,DATABASE_NAME,null,DATABASE_VERSION);
    }

    public static void init(Context context) {
        bdHelper = new BDHelper(context);
    }

    public static BDHelper getInstance() {
        return bdHelper;
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        //- Crear BD
        db.execSQL(ScriptBD.ASIGNATURA_SCRIPT);
        db.execSQL(ScriptBD.ALUMNO_SCRIPT);
        db.execSQL(ScriptBD.EVALUACION_SCRIPT);
        db.execSQL(ScriptBD.CALIFICACION_SCRIPT);
        db.execSQL(ScriptBD.TAREA_SCRIPT);
        db.execSQL(ScriptBD.HORARIO_SCRIPT);
        db.execSQL(ScriptBD.MATRICULA_SCRIPT);

        //- Inserts predefinidos
        db.execSQL(ScriptBD.INSERT_ASIGNATURA1_SCRIPT);
        db.execSQL(ScriptBD.INSERT_ASIGNATURA2_SCRIPT);
        db.execSQL(ScriptBD.INSERT_TAREA1_SCRIPT);
        db.execSQL(ScriptBD.INSERT_TAREA2_SCRIPT);
        db.execSQL(ScriptBD.INSERT_TAREA3_SCRIPT);
        db.execSQL(ScriptBD.INSERT_REVIEW1_SCRIPT);
        db.execSQL(ScriptBD.INSERT_REVIEW2_SCRIPT);
        db.execSQL(ScriptBD.INSERT_ALUMNO1_SCRIPT);
        db.execSQL(ScriptBD.INSERT_ALUMNO2_SCRIPT);
        db.execSQL(ScriptBD.INSERT_CALIFICACION1_SCRIPT);
        db.execSQL(ScriptBD.INSERT_CALIFICACION2_SCRIPT);
        db.execSQL(ScriptBD.INSERT_CALIFICACION3_SCRIPT);
        db.execSQL(ScriptBD.INSERT_CALIFICACION4_SCRIPT);

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        //Actualizacion base de datos
    }

}

@@ -1061,56 +1061,8 @@
 T);%0D
-%0A        db.execSQL(ScriptBD.MATRICULA_SCRIPT);%0D
 %0A%0D%0A 

Revert "Fixed: Table enrollment not created."