Class: CreatePostJsonDocuments

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/post_json/install/templates/create_post_json_documents.rb

Instance Method Summary collapse

Instance Method Details

#changeObject


2
3
4
5
6
7
8
9
10
11
12
# File 'lib/generators/post_json/install/templates/create_post_json_documents.rb', line 2

def change
  create_table :post_json_documents, id: false do |t|
    t.text :id, null: false, index: true
    t.integer :__doc__version
    t.json :__doc__body
    t.uuid :__doc__model_settings_id
  end

  execute "CREATE UNIQUE INDEX post_json_documents_unique_id ON post_json_documents(id, __doc__model_settings_id);"
  execute "ALTER TABLE post_json_documents ADD PRIMARY KEY (id, __doc__model_settings_id);"
end