Sha256: 62e4061796316c91ddadccb1e44259379eb34bd91917b8d38891caffa68eafcd

Contents?: true

Size: 524 Bytes

Versions: 8

Compression:

Stored size: 524 Bytes

Contents

# frozen_string_literal: true
require 'active_record/migration'

class CreateEmailProviders < ActiveRecord::Migration[5.0]
  def change
    create_table :email_providers do |t|
      t.text :value, unique: true
    end

    reversible do |dir|
      file = "#{File.dirname(__FILE__)}/free-email-providers.txt"
      dir.up do
        File.open(file).each do |provider|
          execute "insert into email_providers (value) values (\"#{provider.strip}\")"
        end
      end
      dir.down do
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
osa-0.2.3 lib/osa/migrations/00002_create_email_providers.rb
osa-0.2.2 lib/osa/migrations/00002_create_email_providers.rb
osa-0.2.1 lib/osa/migrations/00002_create_email_providers.rb
osa-0.2.0 lib/osa/migrations/00002_create_email_providers.rb
osa-0.1.3 lib/osa/migrations/00002_create_email_providers.rb
osa-0.1.2 lib/osa/migrations/00002_create_email_providers.rb
osa-0.1.1 lib/osa/migrations/00002_create_email_providers.rb
osa-0.1.0 lib/osa/migrations/00002_create_email_providers.rb