{ "id": "84048", "key": "TIMOB-6756", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "12571", "description": "CI for 1_7_X", "name": "Release 1.7.6", "archived": true, "released": false }, { "id": "12580", "description": "Dual Runtime 1.8.0", "name": "Release 1.8.0.1", "archived": true, "released": true, "releaseDate": "2011-12-22" }, { "id": "12091", "description": "", "name": "Sprint 2011-51", "archived": true, "released": true, "releaseDate": "2011-12-26" }, { "id": "12593", "name": "Release 2.0.0", "archived": false, "released": true, "releaseDate": "2012-03-30" }, { "id": "12677", "description": "Release 1.8 Service Pack 1", "name": "Release 1.8.1", "archived": true, "released": true, "releaseDate": "2012-01-31" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-12-20T14:21:19.000+0000", "created": "2011-12-19T10:39:37.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "module_filesystem", "qe-testadded" ], "versions": [ { "id": "12570", "name": "Release 1.7.5", "archived": true, "released": true, "releaseDate": "2011-11-02" }, { "id": "12580", "description": "Dual Runtime 1.8.0", "name": "Release 1.8.0.1", "archived": true, "released": true, "releaseDate": "2011-12-22" } ], "issuelinks": [ { "id": "14314", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "inwardIssue": { "id": "83986", "key": "TIMOB-6784", "fields": { "summary": "iOS: Database - data not transferred when populated database migrated from Titanium's old database folder to Private Documents", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2012-02-03T13:26:17.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": ".h4 PROBLEM DESCRIPTION\r\nDB Migration for 1.7.x->1.8RC3 only copies the name of the database. The data is not being migrated. \r\n\r\n.h4 STEPS TO REPRODUCE\r\n1. Copy the attached code into a new project.\r\n2. Configure tiapp.xml to use 1.7.5. \r\n3. Press the 'Create the DB button'\r\n4. Press the 'Select on the DB button', so you can see that there is data in the db.\r\n5. Close simulator.\r\n6. Modify tiapp.xml to use 1.8RC3. \r\n7. Recompile\r\n8. Open App, and press 'Select on the DB button'. It will complain that there is no data in the db. \r\n\r\n.h4 Code\r\n\r\n\r\n{code:title=app.js|borderStyle=solid}\r\nvar win = Ti.UI.createWindow({\r\n\ttitle:'db testing',\r\n});\r\n\r\nvar db = Titanium.Database.open('mydb');\r\n\r\nvar l3 = Titanium.UI.createLabel({\r\n\ttext:'unicode placeholder',\r\n\twidth:300,\r\n\theight:40,\r\n\ttop:160\r\n});\r\nwin.add(l3);\r\n\r\nvar l = Titanium.UI.createLabel({\r\n\ttext:'See Log for output',\r\n\ttop:10,\r\n\tleft:10,\r\n\theight:'auto',\r\n\twidth:'auto'\r\n});\r\nwin.add(l);\r\n\r\nvar b1 = Titanium.UI.createButton({\r\n\ttitle:'Create the DB',\r\n\twidth:200,\r\n\theight:40,\r\n\ttop:40\r\n});\r\nwin.add(b1);\r\n\r\nb1.addEventListener('click', function()\r\n{\tvar l1 = Titanium.UI.createLabel({\r\n\t\ttext:'2nd context test - see log.',\r\n\t\tcolor:'#fff',\r\n\t\tfont:{fontSize:14},\r\n\t\twidth:'auto',\r\n\t\theight:'auto'\r\n\t});\r\n\t\r\n\twin.add(l1);\r\nvar db = Titanium.Database.open('mydb');\r\ndb.execute('CREATE TABLE IF NOT EXISTS DATABASETEST (ID INTEGER, NAME TEXT)');\r\ndb.execute('DELETE FROM DATABASETEST');\r\n\r\ndb.execute('INSERT INTO DATABASETEST (ID, NAME ) VALUES(?,?)',1,'Name 1');\r\ndb.execute('INSERT INTO DATABASETEST (ID, NAME ) VALUES(?,?)',2,'Name 2');\r\ndb.execute('INSERT INTO DATABASETEST (ID, NAME ) VALUES(?,?)',3,'Name 3');\r\ndb.execute('INSERT INTO DATABASETEST (ID, NAME ) VALUES(?,?)',4,'Name 4');\r\ndb.execute('INSERT INTO DATABASETEST (ID, NAME ) VALUES(?,?)', 5, '\\u2070 \\u00B9 \\u00B2 \\u00B3 \\u2074 \\u2075 \\u2076 \\u2077 \\u2078 \\u2079');\r\nvar updateName = 'I was updated';\r\nvar updateId = 4;\r\ndb.execute('UPDATE DATABASETEST SET NAME = ? WHERE ID = ?', updateName, updateId);\r\n\r\ndb.execute('UPDATE DATABASETEST SET NAME = \"I was updated too\" WHERE ID = 2');\r\n\r\ndb.execute('DELETE FROM DATABASETEST WHERE ID = ?',1);\r\n\r\nTitanium.API.info('JUST INSERTED, rowsAffected = ' + db.rowsAffected);\r\nTitanium.API.info('JUST INSERTED, lastInsertRowId = ' + db.lastInsertRowId);\r\ndb.close();\r\n});\r\n\r\nvar b2 = Titanium.UI.createButton({\r\n\ttitle:'Select on the db',\r\n\twidth:200,\r\n\theight:40,\r\n\ttop:100\r\n});\r\nwin.add(b2);\r\n\r\nb2.addEventListener('click', function()\r\n{\r\nvar db = Titanium.Database.open('mydb');\r\nvar rows = db.execute('SELECT * FROM DATABASETEST');\r\nTitanium.API.info('ROW COUNT = ' + rows.getRowCount());\r\nTitanium.API.info('ROW COUNT = ' + rows.getRowCount());\r\nTitanium.API.info('ROW COUNT = ' + rows.getRowCount());\r\n\r\nwhile (rows.isValidRow())\r\n{\r\n\tTitanium.API.info('ID: ' + rows.field(0) + ' NAME: ' + rows.fieldByName('name') + ' COLUMN NAME ' + rows.fieldName(0));\r\n\tif (rows.field(0)==5)\r\n\t{\r\n\t\tl3.text = rows.fieldByName('name');\r\n\t}\r\n\r\n\trows.next();\r\n}\r\nrows.close();\r\ndb.close(); // close db when you're done to save resources\r\n\tvar l2= Titanium.UI.createLabel({\r\n\t\ttext:'Check the select - see log.',\r\n\t\tcolor:'#fff',\r\n\t\tfont:{fontSize:14},\r\n\t\twidth:'auto',\r\n\t\theight:'auto',\r\n\t\ttop:400,\r\n\t});\r\n\twin.add(l2);\r\n});\r\nvar l3 = Titanium.UI.createLabel({\r\n\ttext:'unicode placeholder',\r\n\twidth:300,\r\n\theight:40,\r\n\ttop:160\r\n});\r\n\r\nwin.open();\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "iOS: Database migration from 1.7.x -> 1.8.x is not copying migrating the data", "creator": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "subtasks": [], "reporter": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "environment": "MobileSDK 1.7.5, MobileSDK 1.8RC3", "comment": { "comments": [ { "id": "176532", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Pull Pending \r\n#1053 against master\r\n#1056 against 1_7_X\r\n#1057 against 1_8_X", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-12-19T12:06:58.000+0000", "updated": "2011-12-19T13:52:24.000+0000" }, { "id": "179217", "author": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing issue\r\n\r\nTested with Ti Studio 1.0.8.201201101928\r\nTi Mob SDK 1.9.0.v20120111233134\r\nOSX Lion\r\niPhone 4S, iPad 2\r\n\r\nExpected behavior of DB being transferred between compilations from one SDK version to another is shown", "updateAuthor": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-13T11:55:08.000+0000", "updated": "2012-01-13T11:55:08.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }