Class: CreateEbookGeneratorTables

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/ebook_generator/migration.rb

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ebook_generator/migration.rb', line 2

def change
  enable_extension 'uuid-ossp'

  create_table :ebooks, id: :uuid, default: "uuid_generate_v4()" do |t|
    t.string    "title",      null: false
    t.string    "creator"
    t.string    "language",   limit: 2
    t.string    "contributor"
    t.text      "description"
    t.string    "publisher"
    t.text      "rights"
    t.string    "subject"
    t.datetime  "created_at"
    t.datetime  "updated_at"
  end

  create_table "sections", force: true do |t|
    t.string   "title",      null: false
    t.text     "content",    null: false
    t.uuid     "ebook_id",   null: false
    t.integer  "position",   null: false
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "sections", ["ebook_id"], name: "index_sections_on_ebook_id", using: :btree
  add_index "sections", ["position"], name: "index_sections_on_position", using: :btree
end