shuiyouren / sqlitepersistentobjects

Automatically exported from code.google.com/p/sqlitepersistentobjects
0 stars 0 forks source link

Once a table for an object has been created, adding new properties to the object will cause save to fail #28

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create an object with some number of properties and save it
2. Notice the save causes a new table to be created
3. Modify that object so it includes an additional property
4. Save again and notice the save fails

What is the expected output? What do you see instead?
I'd expect the table to automatically update with an appropriately new column.  
If that's not the 
expected behavior what's this projects upgrade philosophy?  Say Version 1.0 
ships with a set 
table structure.  1.1 is released with a column added in some table.  How does 
the data get 
upgraded?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by gonz...@gmail.com on 7 Jan 2009 at 10:43

GoogleCodeExporter commented 8 years ago
This is actually a fairly common issue. I work a lot with Django, which suffers 
from
the same problem. Database migration is a fairly resource intensive thing to 
do, in
my opinion. I say you shouldn't generally need to change tables on the fly.

Original comment by ScottALyons on 17 Jan 2009 at 7:40

GoogleCodeExporter commented 8 years ago
I'd also expect the table to automatically update with an appropriately new 
column, so that Version 1.1 can be 
released with a column added in some table.  

Original comment by janeblit...@gmail.com on 4 Feb 2009 at 2:50

GoogleCodeExporter commented 8 years ago
But this could be used for iphone apps.  If v2 of the app changes the table 
structures then how should this work - not got to that point with my apps :) 
but 
presumably the v2 app will see the v1 db after being upgraded...  Should it use 
new 
tables and do the migration itself first time through?

Original comment by kimptoc on 4 Feb 2009 at 7:56

GoogleCodeExporter commented 8 years ago
The problem is, what do you fill in to the already existing rows. I would like 
to see the ability to have a default 
for each property (which would need to also make it through to the init 
function) so that this could be used to 
populate correctly.

Original comment by mattjgal...@gmail.com on 17 Feb 2009 at 5:28

GoogleCodeExporter commented 8 years ago
I have added a consistency check that will alter the table and add a column for 
any missing properties. Please 
test when yo have a chance.

Original comment by jeff.lam...@gmail.com on 19 Feb 2009 at 1:06

GoogleCodeExporter commented 8 years ago
Can't seem to find the revision which this was fixed in? Where did it go Jeff?

Original comment by mattjgal...@gmail.com on 25 Feb 2009 at 10:31