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. OutOfMemoryError: how best to transfer large video files into a byte array?

I got the same problem, when I uploaded the videos to Facebook, I have got
the same issue while uploading big files, have you found any workarround,
even I flushed the outstream on every read. but it did not also seems be the
solution.




> 

2. Internal Mileston

Rekan2 yang punya milestone,
isi internal memory milestone itu defaultnya apa ya? kok serasa banyak
skali..

Sekarang baru isi dikit2..plng gede map yang 7 MB..
Sekarang sisa 52% (103MB)..

Perasaan ini kan bisa dibilang lumayan kan ya? Soalnya yang punya
masih ga sreg..kok tiba2 internal nya sudah 50% >.>

cape dehh

Thx,
Matthew

-- 
"Indonesian Android Community [id-android]" 

3. How to delete a RAW contact in android 2.x without having the Aggregation contact ID

4. No place in Google Checkout to set international tax rates. Do we owe? How to Pay?

5. Be Expert with Google Interview

6. Display some part of HTML file in WebView

7. SMDK 6410 & Latest Android