Sha256: f57f5c85e3d238d11e862cf9967c71b636b839312d141ed3abb3c310d1fb5933
Contents?: true
Size: 1.49 KB
Versions: 1
Compression:
Stored size: 1.49 KB
Contents
class CreateTables < ActiveRecord::Migration =begin def self.up create_table :cars do |t| t.string :name t.timestamps end create_table :users do |t| t.string :first_name t.string :last_name t.string :type t.integer :age t.text :data t.boolean :active, :default => false t.text :description t.datetime :born_at t.timestamps end create_table :phone_numbers do |t| t.string :number t.integer :user_id t.timestamps end create_table :websites do |t| t.string :url t.integer :user_id t.string :dns_provider, :default => 'yahoo' t.timestamps end create_table :cities do |t| t.string :name t.text :data t.timestamps end create_table :clubs do |t| t.string :name end create_table :clubs_users, :id => false do |t| t.integer :user_id, :null => false t.integer :club_id, :null => false end # primary_key is not id. It is paper_id . # model name is Newspaper # set :id => false if the primary_key is string # set :id => false if you do not want autoincremental id create_table :papers, :id => false, :force => true, :primary_key => 'paper_id' do |t| t.string :paper_id, :null => false t.string :name end end def self.down drop_table :users end =end def change create_table :users do |t| t.string :type t.string :name t.timestamps end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
the_jobbook_admin_data-1.3.0a | test/dummy/db/migrate/20091030202259_create_tables.rb |