Class: EasyhooksMigration

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/easyhooks/migration/templates/migration.rb

Class Method Summary collapse

Class Method Details

.downObject



24
25
26
27
# File 'lib/generators/easyhooks/migration/templates/migration.rb', line 24

def self.down
  drop_table :easyhooks_store_values
  drop_table :easyhooks_store
end

.upObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/generators/easyhooks/migration/templates/migration.rb', line 4

def self.up
  create_table :easyhooks_store do |t|
    t.string :context, null: false
    t.string :name, null: false
    t.string :method, null: false
    t.string :endpoint, null: false
    t.timestamps null: true
  end
  add_index :easyhooks_store, i[name context], unique: true

  create_table :easyhooks_store_values do |t|
    t.string :context, null: false
    t.string :key, null: false
    t.string :value, null: false
    t.integer :store_id, null: false, references: :easyhooks_store
    t.timestamps null: true
  end
  add_index :easyhooks_store_values, i[context key]
end