Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/git/git-scm.com.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorScott Chacon <schacon@gmail.com>2012-04-18 03:25:07 +0400
committerScott Chacon <schacon@gmail.com>2012-05-02 23:11:11 +0400
commit8a7219a61002bad94389637618b66a7ff5fb8cc3 (patch)
treebea305d6634b72c774928d3989725ba418509d6c /db
parent0c790c14286bdd8095efcb9fd1be570cfdc41588 (diff)
start of book work
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20120417221951_add_book_stuff.rb33
-rw-r--r--db/migrate/20120417224143_add_book_url.rb9
-rw-r--r--db/schema.rb33
3 files changed, 74 insertions, 1 deletions
diff --git a/db/migrate/20120417221951_add_book_stuff.rb b/db/migrate/20120417221951_add_book_stuff.rb
new file mode 100644
index 00000000..001c1e94
--- /dev/null
+++ b/db/migrate/20120417221951_add_book_stuff.rb
@@ -0,0 +1,33 @@
+class AddBookStuff < ActiveRecord::Migration
+ def up
+ create_table :books do |t|
+ t.string :code
+ t.timestamps
+ end
+ add_index :books, [:code]
+
+ create_table :chapters do |t|
+ t.string :title
+ t.belongs_to :book
+ t.timestamps
+ end
+ add_index :chapters, [:book_id]
+
+ create_table :sections do |t|
+ t.string :title
+ t.string :slug
+ t.text :plain
+ t.text :html
+ t.belongs_to :chapter
+ t.timestamps
+ end
+ add_index :sections, [:slug]
+ add_index :sections, [:chapter_id]
+ end
+
+ def down
+ drop_table :books
+ drop_table :chapters
+ drop_table :sections
+ end
+end
diff --git a/db/migrate/20120417224143_add_book_url.rb b/db/migrate/20120417224143_add_book_url.rb
new file mode 100644
index 00000000..103d626d
--- /dev/null
+++ b/db/migrate/20120417224143_add_book_url.rb
@@ -0,0 +1,9 @@
+class AddBookUrl < ActiveRecord::Migration
+ def up
+ add_column :sections, :source_url, :string
+ end
+
+ def down
+ remove_column :sections, :source_url
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index afb6374e..4fe5c07e 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,24 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120417001921) do
+ActiveRecord::Schema.define(:version => 20120417224143) do
+
+ create_table "books", :force => true do |t|
+ t.string "code"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ add_index "books", ["code"], :name => "index_books_on_code"
+
+ create_table "chapters", :force => true do |t|
+ t.string "title"
+ t.integer "book_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ add_index "chapters", ["book_id"], :name => "index_chapters_on_book_id"
create_table "doc_files", :force => true do |t|
t.string "name"
@@ -48,6 +65,20 @@ ActiveRecord::Schema.define(:version => 20120417001921) do
t.datetime "updated_at", :null => false
end
+ create_table "sections", :force => true do |t|
+ t.string "title"
+ t.string "slug"
+ t.text "plain"
+ t.text "html"
+ t.integer "chapter_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "source_url"
+ end
+
+ add_index "sections", ["chapter_id"], :name => "index_sections_on_chapter_id"
+ add_index "sections", ["slug"], :name => "index_sections_on_slug"
+
create_table "versions", :force => true do |t|
t.string "name"
t.string "commit_sha"