diff options
author | Scott Chacon <schacon@gmail.com> | 2012-03-08 21:09:45 +0400 |
---|---|---|
committer | Scott Chacon <schacon@gmail.com> | 2012-03-08 21:09:45 +0400 |
commit | d04f24a68684defd255969655202224a92f198a5 (patch) | |
tree | 5fad9aed6e0b365fbbc5898dcbbb84ceccab55b2 /db | |
parent | 809c70009405caea73b4f56e0f186f9a3fe97f78 (diff) |
add basic doc db structure and task to fill them from disk
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20120308153738_create_versions.rb | 12 | ||||
-rw-r--r-- | db/migrate/20120308153855_create_doc_files.rb | 9 | ||||
-rw-r--r-- | db/migrate/20120308153921_create_docs.rb | 11 | ||||
-rw-r--r-- | db/migrate/20120308160013_create_doc_versions.rb | 10 | ||||
-rw-r--r-- | db/schema.rb | 39 |
5 files changed, 80 insertions, 1 deletions
diff --git a/db/migrate/20120308153738_create_versions.rb b/db/migrate/20120308153738_create_versions.rb new file mode 100644 index 00000000..091b35f5 --- /dev/null +++ b/db/migrate/20120308153738_create_versions.rb @@ -0,0 +1,12 @@ +class CreateVersions < ActiveRecord::Migration + def change + create_table :versions do |t| + t.string :name + t.string :commit_sha + t.string :tree_sha + t.datetime :committed + t.timestamps + end + add_index :versions, [:name] + end +end diff --git a/db/migrate/20120308153855_create_doc_files.rb b/db/migrate/20120308153855_create_doc_files.rb new file mode 100644 index 00000000..ca7ace74 --- /dev/null +++ b/db/migrate/20120308153855_create_doc_files.rb @@ -0,0 +1,9 @@ +class CreateDocFiles < ActiveRecord::Migration + def change + create_table :doc_files do |t| + t.string :name + t.timestamps + end + add_index :doc_files, [:name] + end +end diff --git a/db/migrate/20120308153921_create_docs.rb b/db/migrate/20120308153921_create_docs.rb new file mode 100644 index 00000000..3b943607 --- /dev/null +++ b/db/migrate/20120308153921_create_docs.rb @@ -0,0 +1,11 @@ +class CreateDocs < ActiveRecord::Migration + def change + create_table :docs do |t| + t.text :blob_sha + t.text :plain + t.text :html + t.timestamps + end + add_index :docs, [:blob_sha] + end +end diff --git a/db/migrate/20120308160013_create_doc_versions.rb b/db/migrate/20120308160013_create_doc_versions.rb new file mode 100644 index 00000000..a281aef5 --- /dev/null +++ b/db/migrate/20120308160013_create_doc_versions.rb @@ -0,0 +1,10 @@ +class CreateDocVersions < ActiveRecord::Migration + def change + create_table :doc_versions do |t| + t.belongs_to :version + t.belongs_to :doc + t.belongs_to :doc_file + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 671c0dae..99e5aaa8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,6 +10,43 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 0) do +ActiveRecord::Schema.define(:version => 20120308160013) do + + create_table "doc_files", :force => true do |t| + t.string "name" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "doc_files", ["name"], :name => "index_doc_files_on_name" + + create_table "doc_versions", :force => true do |t| + t.integer "version_id" + t.integer "doc_id" + t.integer "doc_file_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "docs", :force => true do |t| + t.text "blob_sha" + t.text "plain" + t.text "html" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "docs", ["blob_sha"], :name => "index_docs_on_blob_sha" + + create_table "versions", :force => true do |t| + t.string "name" + t.string "commit_sha" + t.string "tree_sha" + t.datetime "committed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "versions", ["name"], :name => "index_versions_on_name" end |