Sha256: a1d5aa5d9a47d6128b652c6ea5e2c5d791452950d7b055d161dbdef3fb5d471b

Contents?: true

Size: 788 Bytes

Versions: 16

Compression:

Stored size: 788 Bytes

Contents

module Gaku
  module Migrations

    def self.included(_base)
      ActiveRecord::ConnectionAdapters::Table.send :include, TableDefinition
      ActiveRecord::ConnectionAdapters::TableDefinition.send :include, TableDefinition
    end

    module TableDefinition

      def person_fields
        column :name, :string
        column :surname, :string
        column :middle_name, :string
        column :name_reading, :string, default: ''
        column :middle_name_reading, :string ,  default: ''
        column :surname_reading, :string,  default: ''
        column :gender, :boolean
        column :birth_date, :date
      end

      def counters(*fields)
        fields.each do |field|
          column("#{field}_count", :integer, default: 0)
        end
      end

    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
gaku_core-0.3.0 lib/gaku/migrations.rb
gaku_core-0.3.0.pre.4 lib/gaku/migrations.rb
gaku_core-0.3.0.pre.3 lib/gaku/migrations.rb
gaku_core-0.3.0.pre.2 lib/gaku/migrations.rb
gaku_core-0.3.0.pre.1 lib/gaku/migrations.rb
gaku_core-0.3.0.pre.0 lib/gaku/migrations.rb
gaku-0.2.4 core/lib/gaku/migrations.rb
gaku_core-0.2.4 lib/gaku/migrations.rb
gaku-0.2.3 core/lib/gaku/migrations.rb
gaku_core-0.2.3 lib/gaku/migrations.rb
gaku-0.2.2 core/lib/gaku/migrations.rb
gaku_core-0.2.2 lib/gaku/migrations.rb
gaku-0.2.1 core/lib/gaku/migrations.rb
gaku_core-0.2.1 lib/gaku/migrations.rb
gaku-0.2.0 core/lib/gaku/migrations.rb
gaku_core-0.2.0 lib/gaku/migrations.rb