pardom-zz / ActiveAndroid

Active record style SQLite persistence for Android
http://www.activeandroid.com
4.71k stars 1.03k forks source link

How to provide Migrating scripts in androidstudio #387

Open gsri4 opened 9 years ago

gsri4 commented 9 years ago

I followed the wiki instructions: https://github.com/pardom/ActiveAndroid/wiki/Schema-migrations and tried to add a column to a pre-existing db table but that's not working.

My inital Model class

@Table(name = "Person") public class Person extends Model {

@Column
private String name;

}

All fine.

Then I added a new field called age:

@Table(name = "Person") public class Person extends Model {

@Column
private String name;

@Column
private int age;

} and changed the manifest flag + created the required assets/migrations/2.sql script

ALTER TABLE Person ADD COLUMN age INTEGER;

Where i have to provide this migration script in androidstudio environment. Any clues

jlhonora commented 9 years ago

You have to put it in app/src/main/assets/migrations/$version.sql

gsri4 commented 9 years ago

No assests folder in androidstudio project code

jlhonora commented 9 years ago

Then create it