Class: ObjectSetup

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

Overview

The ObjectSetup class

Instance Method Summary collapse

Methods inherited from Sequel::Migration

down, table_exists?, up

Instance Method Details

#downObject

rubocop: enable Metrics/MethodLength



45
46
47
# File 'lib/runtime/object.rb', line 45

def down
  drop_table?(:object, cascade: true)
end

#upObject

rubocop: disable Metrics/MethodLength



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

def up
  create_table? :object do
    primary_key :id
    foreign_key :parent_id, :object, on_delete: :set_null
    index :name
    index :created_at

    String :name, text: true
    String :short_name, text: true
    String :description, text: true
    String :object_type, null: false
    String :properties, text: true, default: {}.to_yaml.strip
    DateTime :created_at
    DateTime :modified_at
  end
end