database update

by Dan » Fri, 26 Feb 2010 00:40:30 GMT


Sponsored Links
 I've got a question about updating an app after release.  If I have a
database that contains 10 columns and I add a feature that requires an
11th column after the app has been released, where would I put the sql
code to add the new column so that when they install the app it keeps
their current data, but adds that 11th column?  Is that even possible
or would I need to create another table that references the first with
a foreign key?

--



database update

by Mark Murphy » Fri, 26 Feb 2010 00:45:06 GMT


 


In onUpgrade() of your SQLiteOpenHelper subclass.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Warescription: Three Android Books, Plus Updates, One Low Price!

--


Sponsored Links


database update

by Kevin Anthony » Fri, 26 Feb 2010 01:53:55 GMT


 Alter
 http://www.techonthenet.com/sql/tables/alter_table.php 

Kevin




I've got a question about updating an app after release.  If I have a
database that contains 10 columns and I add a feature that requires an
11th column after the app has been released, where would I put the sql
code to add the new column so that when they install the app it keeps
their current data, but adds that 11th column?  Is that even possible
or would I need to create another table that references the first with
a foreign key?

--



database update

by Dan » Fri, 26 Feb 2010 04:35:36 GMT


 thanks, so the onCreate gets called when the database has not been
created and the onupgrade gets called when the database has been
created, but the app is being upgraded?  Do these methods get called
due to some global variable that gets reset upon a fresh or upgraded
install of the app?






--



database update

by Mark Murphy » Fri, 26 Feb 2010 05:24:47 GMT


 


Yes on the first. More accurately for the second, onUpgrade() will be
called when the schema revision (parameter in the SQLiteOpenHelper
constructor) changes.


No, they get called when you ask your SQLiteOpenHelper subclass to
getWriteableDatabase(), for example. The determination of whether an
upgrade is needed is based on some metadata tucked away in some corner
of the database.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Warescription: Three Android Books, Plus Updates, One Low Price!

--



Other Threads

1. ralink wifi

I need an android app to be able to use my ralink wifi  card with a
usb powered external antenna with an arnova 10 Is this even possible?
This is my first experience with android so please be gentle!

RaConfig Version 3.1.4.0       Date 11-26-09

Driver Version  2.3.9.0           Date 11-26-09

DLL Version  1.0.4.0             Date 11-26-09


EEPROM Version  1.1


Firmware Version  0.22







thanks

-- 

2. Obtaining application icons.

I have an activity that displays various statistics about installed/
running applications. I would like to obtain the icons of various
installed/running applications to display along side these statistics.
Could someone direct me to the proper classes/methods to research
within the API?

Thanks in advance,

Dan

-- 

3. Clip Image

4. BPP in Android planned?

5. Views inside a custom ViewGroup not rendering after a size change

6. Bls: Need Help..DHD kerendam air

7. Access Androidify avatar from another app