Sha256: f1872042c6b41103d89513e5a0e66e66c18b3000affcd488b7116e316d5750d0

Contents?: true

Size: 1.67 KB

Versions: 12

Compression:

Stored size: 1.67 KB

Contents

class CreateTables < ActiveRecord::Migration
  def self.up

    create_table(:articles, :primary_key => 'article_id') do |t|
      t.string :title ,           :null => false, :limit => 200
      t.text :body,               :null => false
      t.text :body_html,          :null => false
      t.text :short_desc
      t.string :status,           :default => 'draft', :limit => 50
      t.datetime :published_at,   :null => true
      t.boolean :approved
      t.integer :hits_count
      t.string :magazine_type
      t.timestamps
      t.integer :magazine_id # so that created_at and updated_at are not at the end
      t.text :data
    end

    create_table :tech_magazines do |t|
      t.timestamps
    end

    create_table :comments do |t|
      t.integer :article_id,      :null => false
      t.text :body,               :null => false
      t.text :body_html,          :null => false
      t.string :author_name,      :null => false
      t.string :author_website,   :null => true
      t.boolean :posted_by_admin, :default => false

      t.timestamps
    end

    create_table :cars do |t|
      t.integer :year
      t.string :brand
      t.timestamps
    end

    create_table :doors do |t|
      t.string :color
      t.integer :car_id
      t.timestamps
    end

    create_table :cities do |t|
      t.string :name
      t.string :permanent_name
      t.timestamps
    end

    create_table :engines do |t|
      t.integer :cylinders
      t.integer :car_id
      t.timestamps
    end

  end

  def self.down
    drop_table :comments
    drop_table :tech_magaznines
    drop_table :articles
    drop_table :cars
    drop_table :doors
    drop_table :cities
    drop_table :engines
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
admin_data-1.0.11 test/rails_root/db/migrate/20090809061114_create_tables.rb
admin_data-1.0.10 test/rails_root/db/migrate/20090809061114_create_tables.rb
admin_data-1.0.9 test/rails_root/db/migrate/20090809061114_create_tables.rb
admin_data-1.0.8 test/rails_root/db/migrate/20090809061114_create_tables.rb
admin_data-1.0.7 test/rails_root/db/migrate/20090809061114_create_tables.rb
admin_data-1.0.6 test/rails_root/db/migrate/20090809061114_create_tables.rb
admin_data-1.0.5 test/rails_root/db/migrate/20090809061114_create_tables.rb
admin_data-1.0.4 test/rails_root/db/migrate/20090809061114_create_tables.rb
admin_data-1.0.3 test/rails_root/db/migrate/20090809061114_create_tables.rb
admin_data-1.0.2 test/rails_root/db/migrate/20090809061114_create_tables.rb
admin_data-1.0.1 test/rails_root/db/migrate/20090809061114_create_tables.rb
admin_data-1.0.0 test/rails_root/db/migrate/20090809061114_create_tables.rb