Module: Mycroseconds::Migration::TableDefinition

Defined in:
lib/mycroseconds/migration.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



29
30
31
32
33
# File 'lib/mycroseconds/migration.rb', line 29

def self.included(base)
  base.class_eval do
    alias_method_chain :timestamps, :precision
  end
end

Instance Method Details

#timestamps_with_precision(*args) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/mycroseconds/migration.rb', line 35

def timestamps_with_precision(*args)
  timestamps_without_precision(*args)

  if @base.adapter_name.downcase == 'mysql'
    column(:updated_at_precision, :integer, :default => 0, :null => false)
  end
end