Add SetDefaultBranchDefaultToNil migration

default_branch now defaults to nil, not 'master'. It will be set after the first
push by discover_default_branch.
This commit is contained in:
Robert Speicher 2012-09-05 01:00:07 -04:00
parent 36738897bf
commit f06d98e907
3 changed files with 22 additions and 10 deletions

View file

@ -187,7 +187,7 @@ end
# private_flag :boolean(1) default(TRUE), not null # private_flag :boolean(1) default(TRUE), not null
# code :string(255) # code :string(255)
# owner_id :integer(4) # owner_id :integer(4)
# default_branch :string(255) default("master"), not null # default_branch :string(255)
# issues_enabled :boolean(1) default(TRUE), not null # issues_enabled :boolean(1) default(TRUE), not null
# wall_enabled :boolean(1) default(TRUE), not null # wall_enabled :boolean(1) default(TRUE), not null
# merge_requests_enabled :boolean(1) default(TRUE), not null # merge_requests_enabled :boolean(1) default(TRUE), not null

View file

@ -0,0 +1,12 @@
class SetDefaultBranchDefaultToNil < ActiveRecord::Migration
def up
# Set the default_branch to allow nil, and default it to nil
change_column_null(:projects, :default_branch, true)
change_column_default(:projects, :default_branch, nil)
end
def down
change_column_null(:projects, :default_branch, false)
change_column_default(:projects, :default_branch, 'master')
end
end

View file

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20120729131232) do ActiveRecord::Schema.define(:version => 20120905043334) do
create_table "events", :force => true do |t| create_table "events", :force => true do |t|
t.string "target_type" t.string "target_type"
@ -103,7 +103,7 @@ ActiveRecord::Schema.define(:version => 20120729131232) do
t.boolean "private_flag", :default => true, :null => false t.boolean "private_flag", :default => true, :null => false
t.string "code" t.string "code"
t.integer "owner_id" t.integer "owner_id"
t.string "default_branch", :default => "master", :null => false t.string "default_branch"
t.boolean "issues_enabled", :default => true, :null => false t.boolean "issues_enabled", :default => true, :null => false
t.boolean "wall_enabled", :default => true, :null => false t.boolean "wall_enabled", :default => true, :null => false
t.boolean "merge_requests_enabled", :default => true, :null => false t.boolean "merge_requests_enabled", :default => true, :null => false