{"action":"created","issue":{"url":"https://api.github.com/repos/fuel/core/issues/1803","labels_url":"https://api.github.com/repos/fuel/core/issues/1803/labels{/name}","comments_url":"https://api.github.com/repos/fuel/core/issues/1803/comments","events_url":"https://api.github.com/repos/fuel/core/issues/1803/events","html_url":"https://github.com/fuel/core/pull/1803","id":51905818,"number":1803,"title":"enable create table in sqlite3","user":{"login":"KenjiOhtsuka","id":1572810,"avatar_url":"https://avatars.githubusercontent.com/u/1572810?v=3","gravatar_id":"","url":"https://api.github.com/users/KenjiOhtsuka","html_url":"https://github.com/KenjiOhtsuka","followers_url":"https://api.github.com/users/KenjiOhtsuka/followers","following_url":"https://api.github.com/users/KenjiOhtsuka/following{/other_user}","gists_url":"https://api.github.com/users/KenjiOhtsuka/gists{/gist_id}","starred_url":"https://api.github.com/users/KenjiOhtsuka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KenjiOhtsuka/subscriptions","organizations_url":"https://api.github.com/users/KenjiOhtsuka/orgs","repos_url":"https://api.github.com/users/KenjiOhtsuka/repos","events_url":"https://api.github.com/users/KenjiOhtsuka/events{/privacy}","received_events_url":"https://api.github.com/users/KenjiOhtsuka/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2014-12-14T01:38:18Z","updated_at":"2015-10-21T15:41:16Z","closed_at":"2014-12-14T11:33:13Z","pull_request":{"url":"https://api.github.com/repos/fuel/core/pulls/1803","html_url":"https://github.com/fuel/core/pull/1803","diff_url":"https://github.com/fuel/core/pull/1803.diff","patch_url":"https://github.com/fuel/core/pull/1803.patch"},"body":"Modified classes/dbutil.php to enable create table in sqlite3.\r\nPrevious code can't create table with primary index in sqlite3,\r\nbecause previous code generate\r\n```sql\r\nPRIMARY KEY 'id' ('id')\r\n```\r\nbut sqlite3 supports\r\n```sql\r\nPRIMARY KEY ('id')\r\n```\r\n\r\nI used config/db.php setting string to check whether the database is sqlite3.\r\n\r\nThe following code using `Database_Connection` is another way to do it.\r\n```php\r\n$sql .= \",\\n\\tPRIMARY KEY \";\r\nif (strtolower(\\Config::get('db.'.($db ? $db : \\Config::get('db.active')).'.type')) === 'pdo')\r\n{\r\n  if (strtolower(\\Database_Connection::instance($db)->driver_name()) !== 'sqlite')\r\n  {\r\n    $sql .= $key_name;\r\n  }\r\n}\r\n$sql .= $key_name.\" (\" . implode(', ', $primary_keys) . \")\";\r\n```"},"comment":{"url":"https://api.github.com/repos/fuel/core/issues/comments/149936858","html_url":"https://github.com/fuel/core/pull/1803#issuecomment-149936858","issue_url":"https://api.github.com/repos/fuel/core/issues/1803","id":149936858,"user":{"login":"KenjiOhtsuka","id":1572810,"avatar_url":"https://avatars.githubusercontent.com/u/1572810?v=3","gravatar_id":"","url":"https://api.github.com/users/KenjiOhtsuka","html_url":"https://github.com/KenjiOhtsuka","followers_url":"https://api.github.com/users/KenjiOhtsuka/followers","following_url":"https://api.github.com/users/KenjiOhtsuka/following{/other_user}","gists_url":"https://api.github.com/users/KenjiOhtsuka/gists{/gist_id}","starred_url":"https://api.github.com/users/KenjiOhtsuka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KenjiOhtsuka/subscriptions","organizations_url":"https://api.github.com/users/KenjiOhtsuka/orgs","repos_url":"https://api.github.com/users/KenjiOhtsuka/repos","events_url":"https://api.github.com/users/KenjiOhtsuka/events{/privacy}","received_events_url":"https://api.github.com/users/KenjiOhtsuka/received_events","type":"User","site_admin":false},"created_at":"2015-10-21T15:41:16Z","updated_at":"2015-10-21T15:41:16Z","body":"I'm so sorry.\r\nSo should it be like below?\r\n```php\r\n$sql .= \",\\n\\tPRIMARY KEY (\" . implode(', ', $primary_keys) . \")\";\r\n```"}}