diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20170624183854_create_records.rb | 10 | ||||
-rw-r--r-- | db/migrate/20170625004938_create_entries.rb | 12 | ||||
-rw-r--r-- | db/schema.rb | 34 |
3 files changed, 56 insertions, 0 deletions
diff --git a/db/migrate/20170624183854_create_records.rb b/db/migrate/20170624183854_create_records.rb new file mode 100644 index 0000000..d407e15 --- /dev/null +++ b/db/migrate/20170624183854_create_records.rb | |||
@@ -0,0 +1,10 @@ | |||
1 | class CreateRecords < ActiveRecord::Migration[5.1] | ||
2 | def change | ||
3 | create_table :records do |t| | ||
4 | t.text :description | ||
5 | t.references :recordable, polymorphic: true, index: true | ||
6 | |||
7 | t.timestamps | ||
8 | end | ||
9 | end | ||
10 | end | ||
diff --git a/db/migrate/20170625004938_create_entries.rb b/db/migrate/20170625004938_create_entries.rb new file mode 100644 index 0000000..0fb85b2 --- /dev/null +++ b/db/migrate/20170625004938_create_entries.rb | |||
@@ -0,0 +1,12 @@ | |||
1 | class CreateEntries < ActiveRecord::Migration[5.1] | ||
2 | def change | ||
3 | create_table :entries do |t| | ||
4 | t.string :title | ||
5 | t.text :body | ||
6 | t.string :slug, null: false | ||
7 | t.string :type, null: false | ||
8 | |||
9 | t.timestamps | ||
10 | end | ||
11 | end | ||
12 | end | ||
diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..6eca6ad --- /dev/null +++ b/db/schema.rb | |||
@@ -0,0 +1,34 @@ | |||
1 | # This file is auto-generated from the current state of the database. Instead | ||
2 | # of editing this file, please use the migrations feature of Active Record to | ||
3 | # incrementally modify your database, and then regenerate this schema definition. | ||
4 | # | ||
5 | # Note that this schema.rb definition is the authoritative source for your | ||
6 | # database schema. If you need to create the application database on another | ||
7 | # system, you should be using db:schema:load, not running all the migrations | ||
8 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations | ||
9 | # you'll amass, the slower it'll run and the greater likelihood for issues). | ||
10 | # | ||
11 | # It's strongly recommended that you check this file into your version control system. | ||
12 | |||
13 | ActiveRecord::Schema.define(version: 20170625004938) do | ||
14 | |||
15 | create_table "entries", force: :cascade do |t| | ||
16 | t.string "title" | ||
17 | t.text "body" | ||
18 | t.string "directory", null: false | ||
19 | t.string "slug", null: false | ||
20 | t.string "type", null: false | ||
21 | t.datetime "created_at", null: false | ||
22 | t.datetime "updated_at", null: false | ||
23 | end | ||
24 | |||
25 | create_table "records", force: :cascade do |t| | ||
26 | t.text "description" | ||
27 | t.string "recordable_type" | ||
28 | t.integer "recordable_id" | ||
29 | t.datetime "created_at", null: false | ||
30 | t.datetime "updated_at", null: false | ||
31 | t.index ["recordable_type", "recordable_id"], name: "index_records_on_recordable_type_and_recordable_id" | ||
32 | end | ||
33 | |||
34 | end | ||