Commit f06d98e907f71dc9b3a4a2da0db1c096b6c07024
1 parent
36738897
Exists in
master
and in
4 other branches
Add SetDefaultBranchDefaultToNil migration
default_branch now defaults to nil, not 'master'. It will be set after the first push by discover_default_branch.
Showing
3 changed files
with
22 additions
and
10 deletions
Show diff stats
app/models/project.rb
... | ... | @@ -187,7 +187,7 @@ end |
187 | 187 | # private_flag :boolean(1) default(TRUE), not null |
188 | 188 | # code :string(255) |
189 | 189 | # owner_id :integer(4) |
190 | -# default_branch :string(255) default("master"), not null | |
190 | +# default_branch :string(255) | |
191 | 191 | # issues_enabled :boolean(1) default(TRUE), not null |
192 | 192 | # wall_enabled :boolean(1) default(TRUE), not null |
193 | 193 | # merge_requests_enabled :boolean(1) default(TRUE), not null | ... | ... |
db/migrate/20120905043334_set_default_branch_default_to_nil.rb
0 → 100644
... | ... | @@ -0,0 +1,12 @@ |
1 | +class SetDefaultBranchDefaultToNil < ActiveRecord::Migration | |
2 | + def up | |
3 | + # Set the default_branch to allow nil, and default it to nil | |
4 | + change_column_null(:projects, :default_branch, true) | |
5 | + change_column_default(:projects, :default_branch, nil) | |
6 | + end | |
7 | + | |
8 | + def down | |
9 | + change_column_null(:projects, :default_branch, false) | |
10 | + change_column_default(:projects, :default_branch, 'master') | |
11 | + end | |
12 | +end | ... | ... |
db/schema.rb
... | ... | @@ -11,7 +11,7 @@ |
11 | 11 | # |
12 | 12 | # It's strongly recommended to check this file into your version control system. |
13 | 13 | |
14 | -ActiveRecord::Schema.define(:version => 20120729131232) do | |
14 | +ActiveRecord::Schema.define(:version => 20120905043334) do | |
15 | 15 | |
16 | 16 | create_table "events", :force => true do |t| |
17 | 17 | t.string "target_type" |
... | ... | @@ -98,16 +98,16 @@ ActiveRecord::Schema.define(:version => 20120729131232) do |
98 | 98 | t.string "name" |
99 | 99 | t.string "path" |
100 | 100 | t.text "description" |
101 | - t.datetime "created_at", :null => false | |
102 | - t.datetime "updated_at", :null => false | |
103 | - t.boolean "private_flag", :default => true, :null => false | |
101 | + t.datetime "created_at", :null => false | |
102 | + t.datetime "updated_at", :null => false | |
103 | + t.boolean "private_flag", :default => true, :null => false | |
104 | 104 | t.string "code" |
105 | 105 | t.integer "owner_id" |
106 | - t.string "default_branch", :default => "master", :null => false | |
107 | - t.boolean "issues_enabled", :default => true, :null => false | |
108 | - t.boolean "wall_enabled", :default => true, :null => false | |
109 | - t.boolean "merge_requests_enabled", :default => true, :null => false | |
110 | - t.boolean "wiki_enabled", :default => true, :null => false | |
106 | + t.string "default_branch" | |
107 | + t.boolean "issues_enabled", :default => true, :null => false | |
108 | + t.boolean "wall_enabled", :default => true, :null => false | |
109 | + t.boolean "merge_requests_enabled", :default => true, :null => false | |
110 | + t.boolean "wiki_enabled", :default => true, :null => false | |
111 | 111 | end |
112 | 112 | |
113 | 113 | create_table "protected_branches", :force => true do |t| | ... | ... |