Sha256: dbb19d44e3ab5d9a822f51e4efadad5959958fa140240736492788043151981c

Contents?: true

Size: 955 Bytes

Versions: 4

Compression:

Stored size: 955 Bytes

Contents

class <%= migration_name %> < ActiveRecord::Migration::Current

  def change
    create_table :snapshots<%= table_options %> do |t|
      t.belongs_to :item, polymorphic: true, null: false, index: true
      t.belongs_to :user, polymorphic: true

      t.string :identifier, index: true
      t.index [:identifier, :item_id, :item_type], unique: true

      t.<%= ActiveSnapshot.config.storage_method == 'native_json' ? 'json' : 'text' %> :metadata

      t.datetime :created_at, null: false
    end

    create_table :snapshot_items<%= table_options %> do |t|
      t.belongs_to :snapshot, null: false, index: true
      t.belongs_to :item, polymorphic: true, null: false, index: true
      t.index [:snapshot_id, :item_id, :item_type], unique: true

      t.<%= ActiveSnapshot.config.storage_method == 'native_json' ? 'json' : 'text' %> :object, null: false

      t.datetime :created_at, null: false
      t.string :child_group_name
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
active_snapshot-0.5.1 lib/generators/active_snapshot/install/templates/create_snapshots_tables.rb.erb
active_snapshot-0.5.0 lib/generators/active_snapshot/install/templates/create_snapshots_tables.rb.erb
active_snapshot-0.4.0 lib/generators/active_snapshot/install/templates/create_snapshots_tables.rb.erb
active_snapshot-0.3.2 lib/generators/active_snapshot/install/templates/create_snapshots_tables.rb.erb