add migrations

This commit is contained in:
Connor Turland 2016-03-13 11:24:00 +11:00
parent d863d1c15b
commit fe578ca3b2
3 changed files with 29 additions and 6 deletions

View file

@ -0,0 +1,13 @@
class CreateEvents < ActiveRecord::Migration
def change
create_table :events do |t|
t.string :kind, limit: 255
t.references :eventable, polymorphic: true, index: true
t.references :user, index: true
t.references :map, index: true
t.integer :sequence_id, index: true, default: nil, null: true
t.timestamps
end
add_index :events, [:map_id, :sequence_id], unique: true
end
end

View file

@ -0,0 +1,10 @@
class CreateWebhooks < ActiveRecord::Migration
def change
create_table :webhooks do |t|
t.references :hookable, polymorphic: true, index: true
t.string :kind, null: false
t.string :uri, null: false
t.text :event_types, array: true, default: []
end
end
end

View file

@ -11,27 +11,27 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160310200131) do
ActiveRecord::Schema.define(version: 20160312235006) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "events", force: :cascade do |t|
t.string "kind", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
t.integer "eventable_id"
t.string "eventable_type", limit: 255
t.string "eventable_type"
t.integer "user_id"
t.integer "map_id"
t.integer "sequence_id"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "events", ["created_at"], name: "index_events_on_created_at", using: :btree
add_index "events", ["eventable_type", "eventable_id"], name: "index_events_on_eventable_type_and_eventable_id", using: :btree
add_index "events", ["map_id", "sequence_id"], name: "index_events_on_map_id_and_sequence_id", unique: true, using: :btree
add_index "events", ["map_id"], name: "index_events_on_map_id", using: :btree
add_index "events", ["eventable_type", "eventable_id"], name: "index_events_on_eventable_type_and_eventable_id", using: :btree
add_index "events", ["sequence_id"], name: "index_events_on_sequence_id", using: :btree
add_index "events", ["user_id"], name: "index_events_on_user_id", using: :btree
create_table "in_metacode_sets", force: :cascade do |t|
t.integer "metacode_id"