Sha256: a75fe1588a61646ad4d46b02a7d50e0c603ddbf2ae7066231c572d265d27551c

Contents?: true

Size: 730 Bytes

Versions: 13

Compression:

Stored size: 730 Bytes

Contents

class CreateLists < ActiveRecord::Migration
  def up
    create_table :lists, force:  true do |t|
      t.integer :user_id
      t.string :name
      t.timestamps
    end
    
    add_index :lists, :user_id
    
    create_table :list_items, force:  true do |t|
      t.integer :list_id
      t.integer :user_id
      t.string :thing_type
      t.integer :thing_id
      t.integer :position
      t.timestamps
    end
    
    #add_index :list_items, [:list_id, :position], unique: true
    
    create_table :things, force:  true do |t|
      t.string :name
      t.timestamps
    end
    
    add_index :things, :name, unique: true
  end

  def down
    [:lists, :list_items, :things].each {|table| drop_table table }
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
voluntary-0.7.1 db/migrate/20130817090734_create_lists.rb
voluntary-0.7.0 db/migrate/20130817090734_create_lists.rb
voluntary-0.6.0 db/migrate/20130817090734_create_lists.rb
voluntary-0.5.2 db/migrate/20130817090734_create_lists.rb
voluntary-0.5.1 db/migrate/20130817090734_create_lists.rb
voluntary-0.5.0 db/migrate/20130817090734_create_lists.rb
voluntary-0.4.0 db/migrate/20130817090734_create_lists.rb
voluntary-0.3.0 db/migrate/20130817090734_create_lists.rb
voluntary-0.2.4 db/migrate/20130817090734_create_lists.rb
voluntary-0.2.3 db/migrate/20130817090734_create_lists.rb
voluntary-0.2.2 db/migrate/20130817090734_create_lists.rb
voluntary-0.2.1 db/migrate/20130817090734_create_lists.rb
voluntary-0.2.0 db/migrate/20130817090734_create_lists.rb