Class: LinkSetup

Inherits:
Sequel::Migration show all
Defined in:
lib/runtime/link.rb

Overview

The LinkSetup class

Instance Method Summary collapse

Methods inherited from Sequel::Migration

down, table_exists?, up

Instance Method Details

#downObject

rubocop: enable Metrics/MethodLength



44
45
46
# File 'lib/runtime/link.rb', line 44

def down
  drop_table :link if table_exists? :link
end

#upObject

rubocop: disable Metrics/MethodLength



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/runtime/link.rb', line 27

def up
  # return if table_exists? :link
  log.debug "#up"
  create_table? :link do
    primary_key :id
    foreign_key :from_id, :object, on_delete: :cascade
    foreign_key :to_id, :object, on_delete: :cascade
    index :name
    index :created_at

    String :name
    DateTime :created_at
    DateTime :modified_at
  end
end