Class: CreateStuff

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/public/doc/activerecord/000-activerecord.rb

Overview

ActiveRecord::Base.establish_connection(:adapter => ‘sqlite3’, :database => ‘test.sqlite3’)

Class Method Summary collapse

Class Method Details

.downObject



30
31
# File 'lib/public/doc/activerecord/000-activerecord.rb', line 30

def self.down
end

.upObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/public/doc/activerecord/000-activerecord.rb', line 17

def self.up
  create_table :dogs do |t|
    t.string :name, :null => false
  end
  create_table :toys do |t|
    t.string :name, :null => false
  end
  create_table :dog_toys do |t|
    t.integer :dog_id, :null => false
    t.integer :toy_id, :null => false      
  end
end