Open ido567 opened 9 years ago
I think you have the id column name wrong. Should be "Id" as created by default by ActiveAndroid. Or use the prepopulated DB feature (place existing db in asset directory)
Even after changing the Id field, there is no change. As for now, I want to avoid using prepopulated DB. There is no other way to achieve that?
Where is the 1.sql located? Is it assets/migrations? Try putting breakpoint to DatabaseHelper.executeMigrations() if it finds your upgrade script and executes it.
On Fri, Nov 28, 2014 at 6:20 PM, Ido Bublil notifications@github.com wrote:
Even after changing the Id field, there is no change. As for now, I want to avoid using prepopulated DB. There is no other way to achieve that?
— Reply to this email directly or view it on GitHub https://github.com/pardom/ActiveAndroid/issues/308#issuecomment-64915057 .
S pozdravem Luboš Horáček
The script is skipped because the file number (1) is bigger than the new version number (0). I think there is a bug in the new version number.. Anyway, changing the file name to 0.sql made the trick for me
Check your manifest file for defined database version in meta tag AA_DB_VERSION.
On Mon, Dec 1, 2014 at 6:16 AM, Ido Bublil notifications@github.com wrote:
The script is skipped because the file number (1) is bigger than the new version number (0). I think there is a bug in the new version number.. Anyway, changing the file name to 0.sql made the trick for me
— Reply to this email directly or view it on GitHub https://github.com/pardom/ActiveAndroid/issues/308#issuecomment-65021772 .
S pozdravem Luboš Horáček
AA_DB_VERSION = 1
How come it gives you version number 0 then. Is your source available somewhere?
On Mon, Dec 1, 2014 at 3:52 PM, Ido Bublil notifications@github.com wrote:
AA_DB_VERSION = 1
— Reply to this email directly or view it on GitHub https://github.com/pardom/ActiveAndroid/issues/308#issuecomment-65074988 .
S pozdravem Luboš Horáček
I can share my bitbucket project with you, I just need your username
Same as here "lhoracek"
Done, check it out
Your code works for me. Are you sure you uninstalled you application before trying that script so old version of DB is set to -1 on runtime?
Yes, the old version was -1 but the new version was 0!!
Thats how it's working for me. Inserts are performed as expected and row are in DB. Try uninstalling application completely first and then installing again to have the database recreated.
On Thu, Dec 4, 2014 at 3:36 PM, Ido Bublil notifications@github.com wrote:
Yes, the old version was -1 but the new version was 0!!
— Reply to this email directly or view it on GitHub https://github.com/pardom/ActiveAndroid/issues/308#issuecomment-65640075 .
S pozdravem Luboš Horáček
Using file name of 0.sql is working for me too, but my problem is when I'm using the "1.sql" name. Did you manage to make it work with 0.sql or 1.sql?
I want to create a table for the first time (DB version = 1), and insert into it 2 rows by default. The table needs to be created automatically by the library, and the records should be inserted by the SQL I wrote in 1.sql file.
The table looks fine, but the rows are not inserted at all (no errors thrown).
The model looks like this:
@Table(name = "leagues") public class League extends Model{
} and the 1.sql:
INSERT INTO leagues (id, name) VALUES (1, 'Premier league');