Class: MotionRecord::Schema::Migration

Inherits:
Base
  • Object
show all
Defined in:
lib/motion_record/schema/migration.rb

Constant Summary

Constants included from Persistence

Persistence::TIMESTAMP_COLUMNS

Class Method Summary collapse

Methods inherited from Base

attribute_defaults, attribute_names, #connection, connection, define_attribute, #initialize, #to_attribute_hash

Methods included from MotionRecord::ScopeHelpers

included

Methods included from Persistence

#destroy, #mark_persisted!, #mark_unpersisted!, #persisted?, #save

Methods included from MotionRecord::Serialization

included

Constructor Details

This class inherits a constructor from MotionRecord::Base

Class Method Details

.create_tableObject



20
21
22
23
24
25
# File 'lib/motion_record/schema/migration.rb', line 20

def create_table
  table = Schema::TableDefinition.new(table_name, id: false)
  table.integer :version, :null => false
  table.index :version, :unique => true
  table.execute
end

.primary_keyObject



16
17
18
# File 'lib/motion_record/schema/migration.rb', line 16

def primary_key
  nil
end

.table_exists?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/motion_record/schema/migration.rb', line 12

def table_exists?
  connection.table_exists?(table_name)
end

.table_nameObject



8
9
10
# File 'lib/motion_record/schema/migration.rb', line 8

def table_name
  "schema_migrations"
end