Sha256: 6037eb7cab95552a39589b6e4e06767532b2ca1f18a54c06587d58650795a21a

Contents?: true

Size: 786 Bytes

Versions: 1

Compression:

Stored size: 786 Bytes

Contents

# This migration comes from spree (originally 20160420044191)
class CreateSpreeWalletPaymentSources < ActiveRecord::Migration[4.2]
  def change
    return if table_exists?(:spree_wallet_payment_sources)

    create_table :spree_wallet_payment_sources do |t|
      t.references(
        :user,
        foreign_key: { to_table: Spree.user_class.table_name },
        index: true,
        null: false,
      )
      t.references :payment_source, polymorphic: true, null: false
      t.boolean :default, default: false, null: false

      t.timestamps null: false
    end

    add_index(
      :spree_wallet_payment_sources,
      [:user_id, :payment_source_id, :payment_source_type],
      unique: true,
      name: 'index_spree_wallet_payment_sources_on_source_and_user',
    )
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alchemy-solidus-2.2.0 spec/dummy/db/migrate/20180910094557_create_spree_wallet_payment_sources.spree.rb