Class: ObjectSetup

Inherits:
Sequel::Migration show all
Defined in:
lib/story_teller/inform/relational/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



48
49
50
# File 'lib/story_teller/inform/relational/object.rb', line 48

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

#upObject

rubocop: disable Metrics/MethodLength



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/story_teller/inform/relational/object.rb', line 30

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