Skip to content

Commit

Permalink
Create initial document model
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasleese committed Dec 21, 2016
1 parent edaf087 commit 2207ad6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
3 changes: 3 additions & 0 deletions app/models/document.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Document < ApplicationRecord

end
15 changes: 15 additions & 0 deletions db/migrate/20161220134413_create_documents.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class CreateDocuments < ActiveRecord::Migration[5.0]
def up
create_table :documents do |t|
t.string :content_id
t.string :locale
end

add_index :documents, [:content_id, :locale], :unique => true
end

def down
remove_index :documents, [:content_id, :locale]
drop_table :documents
end
end
14 changes: 9 additions & 5 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20161219143746) do
ActiveRecord::Schema.define(version: 20161220134413) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -50,7 +50,6 @@
end

create_table "content_items", force: :cascade do |t|
t.string "content_id"
t.string "title"
t.datetime "public_updated_at"
t.json "details", default: {}
Expand All @@ -70,12 +69,11 @@
t.datetime "first_published_at"
t.datetime "last_edited_at"
t.string "state"
t.string "locale"
t.integer "user_facing_version"
t.string "base_path"
t.string "content_store"
t.index ["content_id", "state", "locale"], name: "index_content_items_on_content_id_and_state_and_locale", using: :btree
t.index ["content_id"], name: "index_content_items_on_content_id", using: :btree
t.string "content_id"
t.string "locale"
t.index ["document_type"], name: "index_content_items_on_document_type", using: :btree
t.index ["last_edited_at"], name: "index_content_items_on_last_edited_at", using: :btree
t.index ["public_updated_at"], name: "index_content_items_on_public_updated_at", using: :btree
Expand All @@ -85,6 +83,12 @@
t.index ["updated_at"], name: "index_content_items_on_updated_at", using: :btree
end

create_table "documents", force: :cascade do |t|
t.string "content_id"
t.string "locale"
t.index ["content_id", "locale"], name: "index_documents_on_content_id_and_locale", unique: true, using: :btree
end

create_table "events", force: :cascade do |t|
t.string "action", null: false
t.json "payload", default: {}
Expand Down

0 comments on commit 2207ad6

Please sign in to comment.