Sha256: e3cd6a2e1f39aa9d20aa704c88c2c9f2fabae6b149fff47d1338c2b362441ddd

Contents?: true

Size: 493 Bytes

Versions: 1

Compression:

Stored size: 493 Bytes

Contents

# frozen_string_literal: true

class CreateLedgerLinks < ActiveRecord::Migration[6.1]
  def change
    create_table <%= prefixed_table_name(:links) %> do |t|
      t.belongs_to :transaction, null: false, foreign_key: { on_delete: :cascade, to_table: <%= prefixed_table_name(:transactions) %> }
      t.belongs_to :linkable, polymorphic: true, null: false
      t.string     :name, null: false
      t.timestamps default: -> { 'NOW()' }

      t.index %i[transaction_id name]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
generalis-0.1.0 lib/generators/generalis/templates/create_ledger_links.rb.erb