This commit is contained in:
Dmitriy Zaporozhets 2011-10-13 04:00:00 +03:00
parent 0f43e98ef8
commit d378468794
317 changed files with 11347 additions and 0 deletions

View file

@ -0,0 +1,28 @@
class DeviseCreateUsers < ActiveRecord::Migration
def self.up
create_table(:users) do |t|
t.database_authenticatable :null => false
t.recoverable
t.rememberable
t.trackable
# t.encryptable
# t.confirmable
# t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
# t.token_authenticatable
t.timestamps
end
add_index :users, :email, :unique => true
add_index :users, :reset_password_token, :unique => true
# add_index :users, :confirmation_token, :unique => true
# add_index :users, :unlock_token, :unique => true
# add_index :users, :authentication_token, :unique => true
end
def self.down
drop_table :users
end
end

View file

@ -0,0 +1,11 @@
class CreateProjects < ActiveRecord::Migration
def change
create_table :projects do |t|
t.string :name
t.string :path
t.text :description
t.timestamps
end
end
end

View file

@ -0,0 +1,13 @@
class CreateUsersProjects < ActiveRecord::Migration
def change
create_table :users_projects do |t|
t.integer :user_id, :null => false
t.integer :project_id, :null => false
t.boolean :read, :default => false
t.boolean :write, :default => false
t.boolean :admin, :default => false
t.timestamps
end
end
end

View file

@ -0,0 +1,5 @@
class AddPrivateFlagToProject < ActiveRecord::Migration
def change
add_column :projects, :private_flag, :boolean, :default => true, :null => false
end
end

View file

@ -0,0 +1,9 @@
class CreateKeys < ActiveRecord::Migration
def change
create_table :keys do |t|
t.integer :user_id, :null => false
t.text :project_id, :null => false
t.timestamps
end
end
end

View file

@ -0,0 +1,5 @@
class AddNameToUser < ActiveRecord::Migration
def change
add_column :users, :name, :string
end
end

View file

@ -0,0 +1,7 @@
class AddKeyTitleToKey < ActiveRecord::Migration
def change
add_column :keys, :key, :text
add_column :keys, :title, :string
remove_column :keys, :project_id
end
end

View file

@ -0,0 +1,5 @@
class AddIdentifierToKey < ActiveRecord::Migration
def change
add_column :keys, :identifier, :string
end
end

View file

@ -0,0 +1,13 @@
class CreateIssues < ActiveRecord::Migration
def change
create_table :issues do |t|
t.string :title
t.text :content
t.integer :assignee_id
t.integer :author_id
t.integer :project_id
t.timestamps
end
end
end

View file

@ -0,0 +1,5 @@
class AddCodeToProject < ActiveRecord::Migration
def change
add_column :projects, :code, :string
end
end

View file

@ -0,0 +1,5 @@
class AddStatusToIssue < ActiveRecord::Migration
def change
add_column :issues, :closed, :boolean, :default => false, :null => false
end
end

View file

@ -0,0 +1,18 @@
class CreateRailsAdminHistoriesTable < ActiveRecord::Migration
def self.up
create_table :rails_admin_histories do |t|
t.text :message # title, name, or object_id
t.string :username
t.integer :item
t.string :table
t.integer :month, :limit => 2
t.integer :year, :limit => 5
t.timestamps
end
add_index(:rails_admin_histories, [:item, :table, :month, :year], :name => 'index_rails_admin_histories' )
end
def self.down
drop_table :rails_admin_histories
end
end

View file

@ -0,0 +1,5 @@
class AddAdminFieldToUser < ActiveRecord::Migration
def change
add_column :users, :admin, :boolean, :default => false, :null => false
end
end

View file

@ -0,0 +1,9 @@
class RemoveAdmin < ActiveRecord::Migration
def up
drop_table :rails_admin_histories
end
def down
raise "No rollback"
end
end

View file

@ -0,0 +1,12 @@
class CreateNotes < ActiveRecord::Migration
def change
create_table :notes do |t|
t.string :note
t.integer :noteable_id
t.string :noteable_type
t.integer :author_id
t.timestamps
end
end
end

View file

@ -0,0 +1,9 @@
class AddProjectIdForNote < ActiveRecord::Migration
def up
add_column :notes, :project_id, :integer
end
def down
remove_column :notes, :project_id, :integer
end
end

View file

@ -0,0 +1,9 @@
class ChangeNoteableIdForNote < ActiveRecord::Migration
def up
change_column :notes, :noteable_id, :string
end
def down
change_column :notes, :noteable_id, :integer
end
end

View file

@ -0,0 +1,5 @@
class AddAttachmentToNote < ActiveRecord::Migration
def change
add_column :notes, :attachment, :string
end
end

View file

@ -0,0 +1,9 @@
class AddAllowRepoCreationForUser < ActiveRecord::Migration
def up
add_column :users, :allowed_create_repo, :boolean, :default => true, :null => false
end
def down
remove_column :users, :allowed_create_repo
end
end

View file

@ -0,0 +1,5 @@
class AddOwnertoProject < ActiveRecord::Migration
def change
add_column :projects, :owner_id, :integer
end
end

View file

@ -0,0 +1,5 @@
class AddProjectsLimitToUser < ActiveRecord::Migration
def change
add_column :users, :projects_limit, :integer, :default => 10
end
end

View file

@ -0,0 +1,9 @@
class RemoveAllowCreateRepoFromUser < ActiveRecord::Migration
def up
remove_column :users, :allowed_create_repo
end
def down
add_column :users, :allowed_create_repo, :boolean, :default => true, :null => false
end
end