/* * Generated by Robotoworks Mechanoid */ package com.robotoworks.example.recipes.content.migrations; import android.database.sqlite.SQLiteDatabase; import com.robotoworks.mechanoid.db.SQLiteMigration; public class DefaultRecipesDBMigrationV2 extends SQLiteMigration { @Override public void onBeforeUp(SQLiteDatabase db) {} @Override public void up(SQLiteDatabase db) { db.execSQL( "alter table recipes add column author_id integer " ); db.execSQL( "create table authors ( " + "_id integer primary key autoincrement, " + "name text " + ") " ); db.execSQL( "create view recipes_with_authors as " + "select " + "r._id as _id, " + "r.title as recipe_title, " + "r.description as recipe_description, " + "r.author_id as author_id, " + "a.name as author_name " + "from recipes as r " + "left join authors as a " + "on r.author_id = a._id " ); } @Override public void onAfterUp(SQLiteDatabase db) {} }