Class | Grit::CommitDb |
In: |
lib/grit/git-ruby/commit_db.rb
|
Parent: | Object |
SCHEMA_VERSION | = | 1 |
db | [RW] | |
git | [RW] |
# File lib/grit/git-ruby/commit_db.rb, line 12 def initialize(git_obj, index_location = nil) @git = git_obj db_file = File.join(index_location || @git.git_dir, 'commit_db') if !File.exists?(db_file) @db = Sequel.open "sqlite:///#{db_file}" setup_tables else @db = Sequel.open "sqlite:///#{db_file}" end end
# File lib/grit/git-ruby/commit_db.rb, line 35 def setup_tables @db << "create table meta (meta_key text, meta_value text)" @db[:meta] << {:meta_key => 'schema', :meta_value => SCHEMA_VERSION} @db << "create table commits (id integer, sha text, author_date integer)" @db << "create table nodes (id integer, path text, type text)" @db << "create table branches (id integer, ref text, commit_id integer)" @db << "create table commit_branches (commit_id integer, branch_id integer)" @db << "create table commit_nodes (commit_id integer, node_id integer, node_sha string)" end