{"action":"created","comment":{"url":"https://api.github.com/repos/fxbox/thinkerbell/pulls/comments/55942288","id":55942288,"diff_hunk":"@@ -0,0 +1,63 @@\n+extern crate rusqlite;\n+\n+pub struct StoredScript {\n+    pub id: Option<i64>,\n+    pub name: String,\n+    pub source: String,\n+    pub is_active: bool\n+}\n+\n+pub struct ScriptDatabase {\n+    connection: rusqlite::Connection\n+}\n+\n+impl ScriptDatabase {\n+\n+    pub fn new(filename: String) -> Self {\n+        let connection = rusqlite::Connection::open(filename).unwrap();\n+        connection.execute(\"CREATE TABLE IF NOT EXISTS scripts (\n+            id          INTEGER PRIMARY KEY AUTOINCREMENT,\n+            name        TEXT NOT NULL UNIQUE,\n+            source      TEXT NOT NULL,\n+            is_active   BOOL NOT NULL DEFAULT 1\n+        )\", &[]).unwrap();\n+\n+        ScriptDatabase {\n+            connection: connection\n+        }\n+    }\n+\n+    pub fn save(&self, script: &mut StoredScript) -> rusqlite::Result<()> {","path":"src/database.rs","position":30,"original_position":30,"commit_id":"ea8e085ecd421262ce38fe57eb5ea3a7b59cb33c","original_commit_id":"ea8e085ecd421262ce38fe57eb5ea3a7b59cb33c","user":{"login":"Yoric","id":10190,"avatar_url":"https://avatars.githubusercontent.com/u/10190?v=3","gravatar_id":"","url":"https://api.github.com/users/Yoric","html_url":"https://github.com/Yoric","followers_url":"https://api.github.com/users/Yoric/followers","following_url":"https://api.github.com/users/Yoric/following{/other_user}","gists_url":"https://api.github.com/users/Yoric/gists{/gist_id}","starred_url":"https://api.github.com/users/Yoric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yoric/subscriptions","organizations_url":"https://api.github.com/users/Yoric/orgs","repos_url":"https://api.github.com/users/Yoric/repos","events_url":"https://api.github.com/users/Yoric/events{/privacy}","received_events_url":"https://api.github.com/users/Yoric/received_events","type":"User","site_admin":false},"body":"I'm not a big fan of calling this `save`. I initially suggested `put`, to  match REST style, but `insert` is actually probably better, to match the signatures of `HashSet`.","created_at":"2016-03-13T19:26:16Z","updated_at":"2016-03-13T19:26:16Z","html_url":"https://github.com/fxbox/thinkerbell/pull/39#discussion_r55942288","pull_request_url":"https://api.github.com/repos/fxbox/thinkerbell/pulls/39","_links":{"self":{"href":"https://api.github.com/repos/fxbox/thinkerbell/pulls/comments/55942288"},"html":{"href":"https://github.com/fxbox/thinkerbell/pull/39#discussion_r55942288"},"pull_request":{"href":"https://api.github.com/repos/fxbox/thinkerbell/pulls/39"}}},"pull_request":{"url":"https://api.github.com/repos/fxbox/thinkerbell/pulls/39","id":62279448,"html_url":"https://github.com/fxbox/thinkerbell/pull/39","diff_url":"https://github.com/fxbox/thinkerbell/pull/39.diff","patch_url":"https://github.com/fxbox/thinkerbell/pull/39.patch","issue_url":"https://api.github.com/repos/fxbox/thinkerbell/issues/39","number":39,"state":"open","locked":false,"title":"super-wip script manager","user":{"login":"mcav","id":42708,"avatar_url":"https://avatars.githubusercontent.com/u/42708?v=3","gravatar_id":"","url":"https://api.github.com/users/mcav","html_url":"https://github.com/mcav","followers_url":"https://api.github.com/users/mcav/followers","following_url":"https://api.github.com/users/mcav/following{/other_user}","gists_url":"https://api.github.com/users/mcav/gists{/gist_id}","starred_url":"https://api.github.com/users/mcav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcav/subscriptions","organizations_url":"https://api.github.com/users/mcav/orgs","repos_url":"https://api.github.com/users/mcav/repos","events_url":"https://api.github.com/users/mcav/events{/privacy}","received_events_url":"https://api.github.com/users/mcav/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-09T19:09:51Z","updated_at":"2016-03-13T19:26:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2ac617af1250a19dd80aa7c320ab04560197ffd4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fxbox/thinkerbell/pulls/39/commits","review_comments_url":"https://api.github.com/repos/fxbox/thinkerbell/pulls/39/comments","review_comment_url":"https://api.github.com/repos/fxbox/thinkerbell/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fxbox/thinkerbell/issues/39/comments","statuses_url":"https://api.github.com/repos/fxbox/thinkerbell/statuses/ea8e085ecd421262ce38fe57eb5ea3a7b59cb33c","head":{"label":"mcav:manager","ref":"manager","sha":"ea8e085ecd421262ce38fe57eb5ea3a7b59cb33c","user":{"login":"mcav","id":42708,"avatar_url":"https://avatars.githubusercontent.com/u/42708?v=3","gravatar_id":"","url":"https://api.github.com/users/mcav","html_url":"https://github.com/mcav","followers_url":"https://api.github.com/users/mcav/followers","following_url":"https://api.github.com/users/mcav/following{/other_user}","gists_url":"https://api.github.com/users/mcav/gists{/gist_id}","starred_url":"https://api.github.com/users/mcav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcav/subscriptions","organizations_url":"https://api.github.com/users/mcav/orgs","repos_url":"https://api.github.com/users/mcav/repos","events_url":"https://api.github.com/users/mcav/events{/privacy}","received_events_url":"https://api.github.com/users/mcav/received_events","type":"User","site_admin":false},"repo":{"id":53362960,"name":"thinkerbell","full_name":"mcav/thinkerbell","owner":{"login":"mcav","id":42708,"avatar_url":"https://avatars.githubusercontent.com/u/42708?v=3","gravatar_id":"","url":"https://api.github.com/users/mcav","html_url":"https://github.com/mcav","followers_url":"https://api.github.com/users/mcav/followers","following_url":"https://api.github.com/users/mcav/following{/other_user}","gists_url":"https://api.github.com/users/mcav/gists{/gist_id}","starred_url":"https://api.github.com/users/mcav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcav/subscriptions","organizations_url":"https://api.github.com/users/mcav/orgs","repos_url":"https://api.github.com/users/mcav/repos","events_url":"https://api.github.com/users/mcav/events{/privacy}","received_events_url":"https://api.github.com/users/mcav/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mcav/thinkerbell","description":"A scripting engine for the Foxbox","fork":true,"url":"https://api.github.com/repos/mcav/thinkerbell","forks_url":"https://api.github.com/repos/mcav/thinkerbell/forks","keys_url":"https://api.github.com/repos/mcav/thinkerbell/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mcav/thinkerbell/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mcav/thinkerbell/teams","hooks_url":"https://api.github.com/repos/mcav/thinkerbell/hooks","issue_events_url":"https://api.github.com/repos/mcav/thinkerbell/issues/events{/number}","events_url":"https://api.github.com/repos/mcav/thinkerbell/events","assignees_url":"https://api.github.com/repos/mcav/thinkerbell/assignees{/user}","branches_url":"https://api.github.com/repos/mcav/thinkerbell/branches{/branch}","tags_url":"https://api.github.com/repos/mcav/thinkerbell/tags","blobs_url":"https://api.github.com/repos/mcav/thinkerbell/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mcav/thinkerbell/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mcav/thinkerbell/git/refs{/sha}","trees_url":"https://api.github.com/repos/mcav/thinkerbell/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mcav/thinkerbell/statuses/{sha}","languages_url":"https://api.github.com/repos/mcav/thinkerbell/languages","stargazers_url":"https://api.github.com/repos/mcav/thinkerbell/stargazers","contributors_url":"https://api.github.com/repos/mcav/thinkerbell/contributors","subscribers_url":"https://api.github.com/repos/mcav/thinkerbell/subscribers","subscription_url":"https://api.github.com/repos/mcav/thinkerbell/subscription","commits_url":"https://api.github.com/repos/mcav/thinkerbell/commits{/sha}","git_commits_url":"https://api.github.com/repos/mcav/thinkerbell/git/commits{/sha}","comments_url":"https://api.github.com/repos/mcav/thinkerbell/comments{/number}","issue_comment_url":"https://api.github.com/repos/mcav/thinkerbell/issues/comments{/number}","contents_url":"https://api.github.com/repos/mcav/thinkerbell/contents/{+path}","compare_url":"https://api.github.com/repos/mcav/thinkerbell/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mcav/thinkerbell/merges","archive_url":"https://api.github.com/repos/mcav/thinkerbell/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mcav/thinkerbell/downloads","issues_url":"https://api.github.com/repos/mcav/thinkerbell/issues{/number}","pulls_url":"https://api.github.com/repos/mcav/thinkerbell/pulls{/number}","milestones_url":"https://api.github.com/repos/mcav/thinkerbell/milestones{/number}","notifications_url":"https://api.github.com/repos/mcav/thinkerbell/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mcav/thinkerbell/labels{/name}","releases_url":"https://api.github.com/repos/mcav/thinkerbell/releases{/id}","deployments_url":"https://api.github.com/repos/mcav/thinkerbell/deployments","created_at":"2016-03-07T22:12:21Z","updated_at":"2016-03-07T22:12:22Z","pushed_at":"2016-03-11T20:37:48Z","git_url":"git://github.com/mcav/thinkerbell.git","ssh_url":"git@github.com:mcav/thinkerbell.git","clone_url":"https://github.com/mcav/thinkerbell.git","svn_url":"https://github.com/mcav/thinkerbell","homepage":"","size":2494,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"fxbox:master","ref":"master","sha":"4e5de7dd019b45c02d1365492d6db44fb547e8ce","user":{"login":"fxbox","id":17052474,"avatar_url":"https://avatars.githubusercontent.com/u/17052474?v=3","gravatar_id":"","url":"https://api.github.com/users/fxbox","html_url":"https://github.com/fxbox","followers_url":"https://api.github.com/users/fxbox/followers","following_url":"https://api.github.com/users/fxbox/following{/other_user}","gists_url":"https://api.github.com/users/fxbox/gists{/gist_id}","starred_url":"https://api.github.com/users/fxbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fxbox/subscriptions","organizations_url":"https://api.github.com/users/fxbox/orgs","repos_url":"https://api.github.com/users/fxbox/repos","events_url":"https://api.github.com/users/fxbox/events{/privacy}","received_events_url":"https://api.github.com/users/fxbox/received_events","type":"Organization","site_admin":false},"repo":{"id":51068121,"name":"thinkerbell","full_name":"fxbox/thinkerbell","owner":{"login":"fxbox","id":17052474,"avatar_url":"https://avatars.githubusercontent.com/u/17052474?v=3","gravatar_id":"","url":"https://api.github.com/users/fxbox","html_url":"https://github.com/fxbox","followers_url":"https://api.github.com/users/fxbox/followers","following_url":"https://api.github.com/users/fxbox/following{/other_user}","gists_url":"https://api.github.com/users/fxbox/gists{/gist_id}","starred_url":"https://api.github.com/users/fxbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fxbox/subscriptions","organizations_url":"https://api.github.com/users/fxbox/orgs","repos_url":"https://api.github.com/users/fxbox/repos","events_url":"https://api.github.com/users/fxbox/events{/privacy}","received_events_url":"https://api.github.com/users/fxbox/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fxbox/thinkerbell","description":"A scripting engine for the Foxbox","fork":false,"url":"https://api.github.com/repos/fxbox/thinkerbell","forks_url":"https://api.github.com/repos/fxbox/thinkerbell/forks","keys_url":"https://api.github.com/repos/fxbox/thinkerbell/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fxbox/thinkerbell/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fxbox/thinkerbell/teams","hooks_url":"https://api.github.com/repos/fxbox/thinkerbell/hooks","issue_events_url":"https://api.github.com/repos/fxbox/thinkerbell/issues/events{/number}","events_url":"https://api.github.com/repos/fxbox/thinkerbell/events","assignees_url":"https://api.github.com/repos/fxbox/thinkerbell/assignees{/user}","branches_url":"https://api.github.com/repos/fxbox/thinkerbell/branches{/branch}","tags_url":"https://api.github.com/repos/fxbox/thinkerbell/tags","blobs_url":"https://api.github.com/repos/fxbox/thinkerbell/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fxbox/thinkerbell/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fxbox/thinkerbell/git/refs{/sha}","trees_url":"https://api.github.com/repos/fxbox/thinkerbell/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fxbox/thinkerbell/statuses/{sha}","languages_url":"https://api.github.com/repos/fxbox/thinkerbell/languages","stargazers_url":"https://api.github.com/repos/fxbox/thinkerbell/stargazers","contributors_url":"https://api.github.com/repos/fxbox/thinkerbell/contributors","subscribers_url":"https://api.github.com/repos/fxbox/thinkerbell/subscribers","subscription_url":"https://api.github.com/repos/fxbox/thinkerbell/subscription","commits_url":"https://api.github.com/repos/fxbox/thinkerbell/commits{/sha}","git_commits_url":"https://api.github.com/repos/fxbox/thinkerbell/git/commits{/sha}","comments_url":"https://api.github.com/repos/fxbox/thinkerbell/comments{/number}","issue_comment_url":"https://api.github.com/repos/fxbox/thinkerbell/issues/comments{/number}","contents_url":"https://api.github.com/repos/fxbox/thinkerbell/contents/{+path}","compare_url":"https://api.github.com/repos/fxbox/thinkerbell/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fxbox/thinkerbell/merges","archive_url":"https://api.github.com/repos/fxbox/thinkerbell/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fxbox/thinkerbell/downloads","issues_url":"https://api.github.com/repos/fxbox/thinkerbell/issues{/number}","pulls_url":"https://api.github.com/repos/fxbox/thinkerbell/pulls{/number}","milestones_url":"https://api.github.com/repos/fxbox/thinkerbell/milestones{/number}","notifications_url":"https://api.github.com/repos/fxbox/thinkerbell/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fxbox/thinkerbell/labels{/name}","releases_url":"https://api.github.com/repos/fxbox/thinkerbell/releases{/id}","deployments_url":"https://api.github.com/repos/fxbox/thinkerbell/deployments","created_at":"2016-02-04T10:20:01Z","updated_at":"2016-02-16T17:28:58Z","pushed_at":"2016-03-11T20:37:49Z","git_url":"git://github.com/fxbox/thinkerbell.git","ssh_url":"git@github.com:fxbox/thinkerbell.git","clone_url":"https://github.com/fxbox/thinkerbell.git","svn_url":"https://github.com/fxbox/thinkerbell","homepage":"","size":2529,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":4,"mirror_url":null,"open_issues_count":25,"forks":4,"open_issues":25,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fxbox/thinkerbell/pulls/39"},"html":{"href":"https://github.com/fxbox/thinkerbell/pull/39"},"issue":{"href":"https://api.github.com/repos/fxbox/thinkerbell/issues/39"},"comments":{"href":"https://api.github.com/repos/fxbox/thinkerbell/issues/39/comments"},"review_comments":{"href":"https://api.github.com/repos/fxbox/thinkerbell/pulls/39/comments"},"review_comment":{"href":"https://api.github.com/repos/fxbox/thinkerbell/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fxbox/thinkerbell/pulls/39/commits"},"statuses":{"href":"https://api.github.com/repos/fxbox/thinkerbell/statuses/ea8e085ecd421262ce38fe57eb5ea3a7b59cb33c"}}}}