Sha256: 639b8384b68619f1f1e70101bb01b05ae1152dddb68841655332877450d49859
Contents?: true
Size: 887 Bytes
Versions: 72
Compression:
Stored size: 887 Bytes
Contents
class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version %> def up if table_exists?(:<%= table_name %>) warn "<%= table_name %> already exists, exiting" return end create_table :<%= table_name %> do |t| <%- fields.each do |key| -%> <%- next if %w(id message_id timestamp updated_at created_at).include?(key.name) -%> <%- sql_type = schema_base.sql_type(key) if %w(record array map).include?(sql_type) conn = ActiveRecord::Base.connection sql_type = conn.respond_to?(:supports_json?) && conn.supports_json? ? :json : :string end -%> t.<%= sql_type %> :<%= key.name %> <%- end -%> t.timestamps # TODO add indexes as necessary end end def down return unless table_exists?(:<%= table_name %>) drop_table :<%= table_name %> end end
Version data entries
72 entries across 72 versions & 1 rubygems