New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on migration from 0.6.2 - column "default_branch" contains null values #160

sam002 opened this Issue Apr 3, 2014 · 0 comments


None yet
2 participants

sam002 commented Apr 3, 2014

updating from 0.6.2 to 0.7 with postgresql after "RAILS_ENV=production rake redmine:plugins:migrate":

Migrating redmine_git_hosting (Redmine Git Hosting Plugin)...
==  AddDefaultBranchToRepositoryGitExtra: migrating ===========================
-- add_column(:repository_git_extras, :default_branch, :string, {:null=>false, :after=>:git_notify})
rake aborted!
An error has occurred, this and all later migrations canceled:

PGError: ERROR:  column "default_branch" contains null values
: ALTER TABLE "repository_git_extras" ADD COLUMN "default_branch" character varying(255) NOT NULL/home/redmine/redmine/plugins/redmine_git_hosting/db/migrate/20140305083200_add_default_branch_to_repository_git_extra.rb:4:in `up'

My hotfix:

diff --git a/db/migrate/20140305083200_add_default_branch_to_repository_git_extra.rb b/db/migrate/20140305083200_add_default_branch_to_repository_git_extra.rb
index de7c713..1e2d42f 100644
--- a/db/migrate/20140305083200_add_default_branch_to_repository_git_extra.rb
+++ b/db/migrate/20140305083200_add_default_branch_to_repository_git_extra.rb
@@ -1,7 +1,7 @@
 class AddDefaultBranchToRepositoryGitExtra < ActiveRecord::Migration

   def self.up
-    add_column :repository_git_extras, :default_branch, :string, :null => false, :after => :git_notify
+    add_column :repository_git_extras, :default_branch, :string, :null => false, :default=>"master", :after => :git_notify

   def self.down

How correctly to fix it?

@n-rodriguez n-rodriguez self-assigned this Apr 11, 2014

n-rodriguez added a commit that referenced this issue Apr 16, 2014

@n-rodriguez n-rodriguez removed the planned label Apr 16, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment