{ "id": "108556", "key": "ALOY-487", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "14634", "description": "Alloy 1.0.0", "name": "Alloy 1.0.0", "archived": false, "released": true, "releaseDate": "2013-02-19" }, { "id": "14872", "description": "2013 Sprint 03", "name": "2013 Sprint 03", "archived": true, "released": true, "releaseDate": "2013-02-11" } ], "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2013-02-09T01:39:51.000+0000", "created": "2013-01-25T15:48:13.000+0000", "priority": null, "labels": [ "alloy" ], "versions": [], "issuelinks": [ { "id": "25671", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "108485", "key": "ALOY-508", "fields": { "summary": "sql_new adapter doesn't save the id provided when creating a new object", "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": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2014-01-28T23:28:55.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": "12329", "name": "Runtime", "description": "Generic bucket for uncategorized runtime issues" } ], "description": "If a new model is created that uses a 'INTEGER PRIMARY KEY' designation on a custom id field as specified with an idAttribute field in the model adapter section, when a new model is created and the custom id field is provided at creation time it will not be accepted nor added to the database. \r\n\r\nIf custom id field is omitted on model creation, it will insert the model into the database successfully, with an id value one higher than any existing id value that is currently in the database.\r\n\r\n", "attachment": [], "flagged": false, "summary": "SQL adapter does not accept ID when using PRIMARY KEY", "creator": { "name": "mentalengine!", "key": "mentalengine!", "displayName": "David S", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "mentalengine!", "key": "mentalengine!", "displayName": "David S", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Alloy 0.3.6", "comment": { "comments": [ { "id": "235875", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I believe you had a test case or some code to go with this?", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-25T15:55:34.000+0000", "updated": "2013-01-25T15:55:34.000+0000" }, { "id": "235888", "author": { "name": "mentalengine!", "key": "mentalengine!", "displayName": "David S", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I have modified the SQL Keywords example to use this model;\r\n\r\nexports.definition = {\r\n\tconfig: {\r\n\t\t\"columns\": {\r\n\t\t\tname: 'TEXT',\r\n\t\t\tnickname: 'TEXT',\r\n\r\n\t\t\t// column values can have types with keywords\r\n\t\t\tfighterId: 'INTEGER PRIMARY KEY' \r\n\t\t},\r\n\r\n\t\t\"adapter\": {\r\n\t\t\t\"type\": \"sql_new\",\r\n\r\n\t\t\t// The table name inside the sqlite database to use for\r\n\t\t\t// models and collections based on this definition.\r\n\t\t\t\"collection_name\": \"fighters\",\r\n\r\n\t\t\t// idAttribute tells Alloy/Backbone to use this column in\r\n\t\t\t// my table as its unique identifier field. Without \r\n\t\t\t// specifying this, Alloy's default behavior is to create\r\n\t\t\t// and \"alloy_id\" field which will uniquely identify your\r\n\t\t\t// rows in the table with a text GUID.\r\n\t\t\t\"idAttribute\": \"fighterId\" \r\n\t\t}\r\n\t}\r\n}\r\n\r\nI try to add an item with this code which is triggered on the click of the \"Fighters\" label;\r\n\r\nfunction addTestFighter(e) {\r\n\t// create the test fighter model\r\n\tvar model = Alloy.createModel('fighters', {\r\n\t\tname: 'Name ' + counter,\r\n\t\tnickname: 'Nickname ' + counter,\r\n\t\tfighterId: counter * 100\r\n\t});\r\n\tcounter++;\r\n\r\n\t// add model to the collection and save it to sqlite\r\n\tfighters.add(model);\r\n\tmodel.save();\r\n\r\n\t// let's refresh so we can see the ids coming from the \r\n\t// autoincrement field in the sqlite database in the \r\n\t// row click alerts\r\n\tfighters.fetch();\r\n}\r\n", "updateAuthor": { "name": "mentalengine!", "key": "mentalengine!", "displayName": "David S", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-25T17:09:35.000+0000", "updated": "2013-01-25T17:09:35.000+0000" }, { "id": "236934", "author": { "name": "mentalengine!", "key": "mentalengine!", "displayName": "David S", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tony, any news on this?", "updateAuthor": { "name": "mentalengine!", "key": "mentalengine!", "displayName": "David S", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-02-01T20:01:45.000+0000", "updated": "2013-02-01T20:01:45.000+0000" }, { "id": "237760", "author": { "name": "chustedde", "key": "chustedde", "displayName": "Christina Hustedde", "active": true, "timeZone": "America/New_York" }, "body": "Watching, because I'm having this issue as well.", "updateAuthor": { "name": "chustedde", "key": "chustedde", "displayName": "Christina Hustedde", "active": true, "timeZone": "America/New_York" }, "created": "2013-02-08T18:30:53.000+0000", "updated": "2013-02-08T18:30:53.000+0000" }, { "id": "237885", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This is a duplicate of ALOY-508 and is resolved for 1.0.0", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-02-09T01:39:51.000+0000", "updated": "2013-02-09T01:39:51.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }