Sha256: f48e36680b197eba86d85aeec6c33949a8d08811802cf3939e6b8d2ec8281e3c

Contents?: true

Size: 811 Bytes

Versions: 1

Compression:

Stored size: 811 Bytes

Contents

# frozen_string_literal: true

class GutentagTables < ActiveRecord::Migration
  def up
    create_table :gutentag_taggings do |t|
      t.integer :tag_id,        :null => false
      t.integer :taggable_id,   :null => false
      t.string  :taggable_type, :null => false
      t.timestamps :null => false
    end

    add_index :gutentag_taggings, :tag_id
    add_index :gutentag_taggings, %i[ taggable_type taggable_id ]
    add_index :gutentag_taggings, %i[ taggable_type taggable_id tag_id ],
      :unique => true, :name => "unique_taggings"

    create_table :gutentag_tags do |t|
      t.string :name, :null => false
      t.timestamps :null => false
    end

    add_index :gutentag_tags, :name, :unique => true
  end

  def down
    drop_table :gutentag_tags
    drop_table :gutentag_taggings
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gutentag-2.6.0 db/migrate/1_gutentag_tables.rb