cornerpocket407 / TwitterApp

0 stars 0 forks source link

Trouble creating my schemas properly #1

Closed cornerpocket407 closed 11 years ago

cornerpocket407 commented 11 years ago

@nesquena

I'm having trouble creating my schemas using ActiveAndroid. In my Tweet class, if I annotate the User field with @Column(name = "User"), I see nothing in my RestClient.db file. But if I remove the annotation, Tweets and Users tables are created but Tweets won't have a reference to Users.

I've tried different combinations to get the schemas to create correctly, but nothing worked.

Any idea? Thanks.

nesquena commented 11 years ago

Hey Tony,

Here's what I did. I downloaded your project and added this to the Tweet model:

@Column(name = "user")
public User user;

since the column annotation wasn't there. Then I downloaded the db file and I saw this:

screen shot 2013-09-11 at 1 49 56 am

Adding that annotation shouldn't cause the RestClient.db to have nothing. I think that might have been a red herring. Try uninstalling your application fully, restarting the emulator and trying again. Based on what I just ran, the schema should be generated as expected.

Also note that the user column will be storing the foreign key to the user object by saving the user's id so make sure that before you attempt to save a tweet that the user has already been saved beforehand.

cornerpocket407 commented 11 years ago

Hey Nathan,

Thanks for the reply and confirming that there's nothing wrong with the code. I downloaded a different SQLite Browser and was able to see what you're seeing. :rage: Spent way too much time trying to resolve that issue. Thanks again.

nesquena commented 11 years ago

Ha! I guess I led you astray with the free sqlite viewer in lab. Didn't realize it was so crappy as to not even properly show the tables. Glad we sorted that out

Nathan Esquenazi

On Wednesday, September 11, 2013 at 11:44 AM, Tony Dao wrote:

Hey Nathan, Thanks for the reply and confirming that there's nothing wrong with the code. I downloaded a different SQLite Browser and was able to see what you're seeing. Spent way too much time trying to resolve that issue. Thanks again.

— Reply to this email directly or view it on GitHub (https://github.com/cornerpocket407/TwitterApp/issues/1#issuecomment-24265569).