Blob of db/migrate/002_create_projects.rb (raw blob data)

1 class CreateProjects < ActiveRecord::Migration
2
3 def self.up
4 create_table :projects do |t|
5 t.column :title, :string
6 t.string :summary
7 t.column :user_id, :integer
8 t.string :slug, :unique => true
9 t.string :license
10 t.column :audience, :enum, :limit => [:public, :members_only], :default => :public
11 t.column :status, :enum, :limit => [:active, :inactive, :deleted], :default => :active
12 t.column :life_cycle, :enum, :limit => [:planning, :pre_alpha, :alpha, :beta, :stable, :mature_frozen, :other, :notapplicable], :default => :other
13 t.column :os, :enum, :limit => [:mac_os, :win32, :linux, :independent, :other, :notapplicable], :default => :notapplicable
14 t.column :platform, :enum, :limit => [:ruby, :rails, :dotnet, :python, :php, :other, :notapplicable], :default => :notapplicable
15 t.integer :views, :default => 0
16 t.string :wiki_slug
17 t.timestamps
18 end
19 add_index :projects, :id
20 add_index :projects, :title
21 add_index :projects, :user_id
22 add_index :projects, :slug
23 add_index :projects, [:audience, :status]
24
25 #
26 create_table :members do |t|
27 t.column :accesslevel, :enum, :limit => [:readonly, :modify, :admin], :default => :modify
28 t.integer :project_id, :null => false
29 t.integer :user_id, :null => false
30 t.timestamps
31 end
32 add_index :members, [:id]
33 add_index :members, [:project_id]
34 add_index :members, [:user_id]
35 end
36
37 def self.down
38 drop_table :members
39 drop_table :projects
40 end
41 end