Sha256: ae472c447ab06be11b512cfddd17de4f18a35b6511ee7d348dd91c122fadfc3a

Contents?: true

Size: 896 Bytes

Versions: 2

Compression:

Stored size: 896 Bytes

Contents

class <%= @migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
  def self.up
    enable_extension 'pgcrypto' unless extensions.include?('pgcrypto')
    create_table :transaction_groups, id: :uuid, force: true do |t|
      t.string   :name
      t.text     :description
      t.jsonb    :tags
      t.timestamps
    end

    create_table :transaction_entries, id: :uuid, force: true do |t|
      t.uuid     :transaction_group_id
      t.integer  :value
      t.datetime :txn_time
      t.jsonb    :immutable_tags
      t.jsonb    :mutable_tags

      t.timestamps
    end

    add_index :transaction_entries, :immutable_tags, using: :gin
    add_index :transaction_entries, :mutable_tags, using: :gin
    add_index :transaction_entries, :txn_time
  end

  def self.down
    drop_table :transaction_groups
    drop_table :transaction_entries
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hws-transactions-0.1.1 lib/generators/hws/transactions/templates/create_transaction_group_and_entries.rb.erb
hws-transactions-0.1.0 lib/generators/hws/transactions/templates/create_transaction_group_and_entries.rb.erb