Re: [gitorious] rake db:migrate error

2012-11-02 Thread Scott Allen
Had this same issue during our upgrades last week, but we also had the
following:

$ rake db:migrate

(in /var/www/vmubuntu09.tif.ti.com/gitorious)

==  AddSuspendedAtToProjects: migrating
===

-- add_column(:projects, :suspended_at, :datetime, {:default=nil})

rake aborted!

An error has occurred, all later migrations canceled:



Mysql::Error: Duplicate column name 'suspended_at': ALTER TABLE `projects`
ADD `suspended_at` datetime DEFAULT NULL



(See full trace by running task with --trace)


The work around was to ignore this specific patch, anyone else see this
issue.

$ mv db/migrate/20110223130355_add_suspended_at_to_projects.rb
db/migrate/.20110223130355_add_suspended_at_to_projects.rb.bak

-scott


On Wed, Oct 31, 2012 at 9:40 AM, Thomas Kjeldahl Nilsson 
tho...@gitorious.com wrote:

  Hi again,

 we were finally able to reproduce on our end, and have pushed a minor
 version/hotfix for the issue.


 http://blog.gitorious.org/2012/10/31/gitorious-2-3-2-released-small-hotfix-for-installationdb-setup-issue/

 Peter: I'm closing your merge request as we found a simpler/more direct
 way of fixing the problem in the migration.

 Both of you: Let us know if you have any further issues related to this.
 This one was a bit tricky since we haven't seen the issue locally in our
 own installations up till now.

 Lesson learned on our part: using Rails model classes in migrations is
 brittle, so prefer to manipulate columns/tables directly instead.


 cheers,
 Thomas


 On 10/30/2012 09:18 PM, Peter Kjellerstedt wrote:

  I stumbled upon the same problem the other day when I migrated our
 server. I have created a merge request
 https://gitorious.org/gitorious/mainline/merge_requests/220 that should
 fix the migration (once the MR is completely created, which is taking
 unusually long...) Otherwise you can find the actual change in my clone of
 Gitorious here:
 https://gitorious.org/~saur/gitorious/saurs-mainline/commit/edaebc8129c851b574573041a1e6817c61c1f0b2
 

 ** **

 The problem for you, however, is that you will have to revert the part of
 the failed migration that actually took place before you can apply the
 corrected version (unless you can revert using backups). You will have to
 remove the content_type column from the project_memberships table.

 ** **

 //Peter

 ** **

 *From:* gitorious@googlegroups.com 
 [mailto:gitorious@googlegroups.comgitorious@googlegroups.com]
 *On Behalf Of *Rodrig Lima
 *Sent:* 30 October 2012 14:03
 *To:* gitorious@googlegroups.com
 *Subject:* [gitorious] rake db:migrate error

 ** **

 Hi all,

 ** **

 This is my error:

 ** **

 git@maverick:~$ pwd

 /var/www/gitorious

 git@maverick:~$ bundle exec rake db:migrate

 .

 .

 .

 ==  AddProjectMemberships: migrating
 ==

 -- create_table(:project_memberships)

- 0.0043s

 -- add_index(:project_memberships, [:project_id, :member_id,
 :member_type], {:name=project_memberships_index})

- 0.0062s

 ==  AddProjectMemberships: migrated (0.0110s)
 =

 ** **

 ==  MakeProjectMembershipPolymorphicOnSubject: migrating
 ==

 -- add_column(:project_memberships, :content_type, :string)

- 0.0062s

 rake aborted!

 An error has occurred, all later migrations canceled:

 ** **

 Mysql::Error: Table 'gitorious_production.content_memberships' doesn't
 exist: SELECT * FROM `content_memberships` 

 ** **

 (See full trace by running task with --trace)

 ===

 ** **

 *with --trace*

 ** **

 *git@maverick:~$ bundle exec rake db:migrate --trace*

 *(in /var/www/gitorious)*

 *** Invoke db:migrate (first_time)*

 *** Invoke environment (first_time)*

 *** Execute environment*

 *** Execute db:migrate*

 *==  MakeProjectMembershipPolymorphicOnSubject: migrating
 ==*

 *-- add_column(:project_memberships, :content_type, :string)*

 *rake aborted!*

 *An error has occurred, all later migrations canceled:*

 * *

 *Mysql::Error: Duplicate column name 'content_type': ALTER TABLE
 `project_memberships` ADD `content_type` varchar(255)*

 * *

 ** **

 I'm following this steps:
 http://gitorious.org/gitorious/pages/DebianSqueezeInstallation

 ** **

 ** **

 How can I fix it?

 --
 To post to this group, send email to gitorious@googlegroups.com
 To unsubscribe from this group, send email to
 gitorious+unsubscr...@googlegroups.com
  --
 To post to this group, send email to gitorious@googlegroups.com
 To unsubscribe from this group, send email to
 gitorious+unsubscr...@googlegroups.com



 --
 best regards,
 Thomas Kjeldahl Nilssonhttp://gitorious.com

  --
 To post to this group, send email to gitorious@googlegroups.com
 To unsubscribe from this group, send email to
 gitorious+unsubscr...@googlegroups.com


-- 
To post to 

Re: [gitorious] rake db:migrate error

2012-10-31 Thread Thomas Kjeldahl Nilsson

Hi Peter and Rodrigo,

haven't seen this on my end but I'm helping a customer facing the same 
issue. Peter, thanks a lot for that reference. We may create a hotfix or 
hurry up the next minor version to fix this once we've fixed it in 
master/mainline.


cheers,
Thomas

On 10/30/2012 09:18 PM, Peter Kjellerstedt wrote:


I stumbled upon the same problem the other day when I migrated our 
server. I have created a merge request 
https://gitorious.org/gitorious/mainline/merge_requests/220 that 
should fix the migration (once the MR is completely created, which is 
taking unusually long...) Otherwise you can find the actual change in 
my clone of Gitorious here: 
https://gitorious.org/~saur/gitorious/saurs-mainline/commit/edaebc8129c851b574573041a1e6817c61c1f0b2 
https://gitorious.org/%7Esaur/gitorious/saurs-mainline/commit/edaebc8129c851b574573041a1e6817c61c1f0b2 



The problem for you, however, is that you will have to revert the part 
of the failed migration that actually took place before you can apply 
the corrected version (unless you can revert using backups). You will 
have to remove the content_type column from the project_memberships table.


//Peter

*From:*gitorious@googlegroups.com [mailto:gitorious@googlegroups.com] 
*On Behalf Of *Rodrig Lima

*Sent:* 30 October 2012 14:03
*To:* gitorious@googlegroups.com
*Subject:* [gitorious] rake db:migrate error

Hi all,

This is my error:

git@maverick:~$ pwd

/var/www/gitorious

git@maverick:~$ bundle exec rake db:migrate

.

.

.

==  AddProjectMemberships: migrating 
==


-- create_table(:project_memberships)

   - 0.0043s

-- add_index(:project_memberships, [:project_id, :member_id, 
:member_type], {:name=project_memberships_index})


   - 0.0062s

==  AddProjectMemberships: migrated (0.0110s) 
=


==  MakeProjectMembershipPolymorphicOnSubject: migrating 
==


-- add_column(:project_memberships, :content_type, :string)

   - 0.0062s

rake aborted!

An error has occurred, all later migrations canceled:

Mysql::Error: Table 'gitorious_production.content_memberships' doesn't 
exist: SELECT * FROM `content_memberships`


(See full trace by running task with --trace)

===

*with --trace*

*git@maverick:~$ bundle exec rake db:migrate --trace*

*(in /var/www/gitorious)*

*** Invoke db:migrate (first_time)*

*** Invoke environment (first_time)*

*** Execute environment*

*** Execute db:migrate*

*==  MakeProjectMembershipPolymorphicOnSubject: migrating 
==*


*-- add_column(:project_memberships, :content_type, :string)*

*rake aborted!*

*An error has occurred, all later migrations canceled:*

**

*Mysql::Error: Duplicate column name 'content_type': ALTER TABLE 
`project_memberships` ADD `content_type` varchar(255)*


**

I'm following this steps: 
http://gitorious.org/gitorious/pages/DebianSqueezeInstallation


How can I fix it?

--
To post to this group, send email to gitorious@googlegroups.com 
mailto:gitorious@googlegroups.com

To unsubscribe from this group, send email to
gitorious+unsubscr...@googlegroups.com 
mailto:gitorious+unsubscr...@googlegroups.com


--
To post to this group, send email to gitorious@googlegroups.com
To unsubscribe from this group, send email to
gitorious+unsubscr...@googlegroups.com



--
best regards,
Thomas Kjeldahl Nilsson
http://gitorious.com

--
To post to this group, send email to gitorious@googlegroups.com
To unsubscribe from this group, send email to
gitorious+unsubscr...@googlegroups.com


Re: [gitorious] rake db:migrate error

2012-10-31 Thread Thomas Kjeldahl Nilsson

Hi again,

we were finally able to reproduce on our end, and have pushed a minor 
version/hotfix for the issue.


http://blog.gitorious.org/2012/10/31/gitorious-2-3-2-released-small-hotfix-for-installationdb-setup-issue/

Peter: I'm closing your merge request as we found a simpler/more direct 
way of fixing the problem in the migration.


Both of you: Let us know if you have any further issues related to this. 
This one was a bit tricky since we haven't seen the issue locally in our 
own installations up till now.


Lesson learned on our part: using Rails model classes in migrations is 
brittle, so prefer to manipulate columns/tables directly instead.


cheers,
Thomas


On 10/30/2012 09:18 PM, Peter Kjellerstedt wrote:


I stumbled upon the same problem the other day when I migrated our 
server. I have created a merge request 
https://gitorious.org/gitorious/mainline/merge_requests/220 that 
should fix the migration (once the MR is completely created, which is 
taking unusually long...) Otherwise you can find the actual change in 
my clone of Gitorious here: 
https://gitorious.org/~saur/gitorious/saurs-mainline/commit/edaebc8129c851b574573041a1e6817c61c1f0b2 
https://gitorious.org/%7Esaur/gitorious/saurs-mainline/commit/edaebc8129c851b574573041a1e6817c61c1f0b2 



The problem for you, however, is that you will have to revert the part 
of the failed migration that actually took place before you can apply 
the corrected version (unless you can revert using backups). You will 
have to remove the content_type column from the project_memberships table.


//Peter

*From:*gitorious@googlegroups.com [mailto:gitorious@googlegroups.com] 
*On Behalf Of *Rodrig Lima

*Sent:* 30 October 2012 14:03
*To:* gitorious@googlegroups.com
*Subject:* [gitorious] rake db:migrate error

Hi all,

This is my error:

git@maverick:~$ pwd

/var/www/gitorious

git@maverick:~$ bundle exec rake db:migrate

.

.

.

==  AddProjectMemberships: migrating 
==


-- create_table(:project_memberships)

   - 0.0043s

-- add_index(:project_memberships, [:project_id, :member_id, 
:member_type], {:name=project_memberships_index})


   - 0.0062s

==  AddProjectMemberships: migrated (0.0110s) 
=


==  MakeProjectMembershipPolymorphicOnSubject: migrating 
==


-- add_column(:project_memberships, :content_type, :string)

   - 0.0062s

rake aborted!

An error has occurred, all later migrations canceled:

Mysql::Error: Table 'gitorious_production.content_memberships' doesn't 
exist: SELECT * FROM `content_memberships`


(See full trace by running task with --trace)

===

*with --trace*

*git@maverick:~$ bundle exec rake db:migrate --trace*

*(in /var/www/gitorious)*

*** Invoke db:migrate (first_time)*

*** Invoke environment (first_time)*

*** Execute environment*

*** Execute db:migrate*

*==  MakeProjectMembershipPolymorphicOnSubject: migrating 
==*


*-- add_column(:project_memberships, :content_type, :string)*

*rake aborted!*

*An error has occurred, all later migrations canceled:*

**

*Mysql::Error: Duplicate column name 'content_type': ALTER TABLE 
`project_memberships` ADD `content_type` varchar(255)*


**

I'm following this steps: 
http://gitorious.org/gitorious/pages/DebianSqueezeInstallation


How can I fix it?

--
To post to this group, send email to gitorious@googlegroups.com 
mailto:gitorious@googlegroups.com

To unsubscribe from this group, send email to
gitorious+unsubscr...@googlegroups.com 
mailto:gitorious+unsubscr...@googlegroups.com


--
To post to this group, send email to gitorious@googlegroups.com
To unsubscribe from this group, send email to
gitorious+unsubscr...@googlegroups.com



--
best regards,
Thomas Kjeldahl Nilsson
http://gitorious.com

--
To post to this group, send email to gitorious@googlegroups.com
To unsubscribe from this group, send email to
gitorious+unsubscr...@googlegroups.com


RE: [gitorious] rake db:migrate error

2012-10-30 Thread Peter Kjellerstedt
I stumbled upon the same problem the other day when I migrated our server. I 
have created a merge request 
https://gitorious.org/gitorious/mainline/merge_requests/220 that should fix the 
migration (once the MR is completely created, which is taking unusually 
long...) Otherwise you can find the actual change in my clone of Gitorious 
here: 
https://gitorious.org/~saur/gitorious/saurs-mainline/commit/edaebc8129c851b574573041a1e6817c61c1f0b2

The problem for you, however, is that you will have to revert the part of the 
failed migration that actually took place before you can apply the corrected 
version (unless you can revert using backups). You will have to remove the 
content_type column from the project_memberships table.

//Peter

From: gitorious@googlegroups.com [mailto:gitorious@googlegroups.com] On Behalf 
Of Rodrig Lima
Sent: 30 October 2012 14:03
To: gitorious@googlegroups.com
Subject: [gitorious] rake db:migrate error

Hi all,

This is my error:

git@maverick:~$ pwd
/var/www/gitorious
git@maverick:~$ bundle exec rake db:migrate
.
.
.
==  AddProjectMemberships: migrating ==
-- create_table(:project_memberships)
   - 0.0043s
-- add_index(:project_memberships, [:project_id, :member_id, :member_type], 
{:name=project_memberships_index})
   - 0.0062s
==  AddProjectMemberships: migrated (0.0110s) =

==  MakeProjectMembershipPolymorphicOnSubject: migrating ==
-- add_column(:project_memberships, :content_type, :string)
   - 0.0062s
rake aborted!
An error has occurred, all later migrations canceled:

Mysql::Error: Table 'gitorious_production.content_memberships' doesn't exist: 
SELECT * FROM `content_memberships`

(See full trace by running task with --trace)
===

with --trace

git@maverick:~$ bundle exec rake db:migrate --trace
(in /var/www/gitorious)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
==  MakeProjectMembershipPolymorphicOnSubject: migrating ==
-- add_column(:project_memberships, :content_type, :string)
rake aborted!
An error has occurred, all later migrations canceled:

Mysql::Error: Duplicate column name 'content_type': ALTER TABLE 
`project_memberships` ADD `content_type` varchar(255)


I'm following this steps: 
http://gitorious.org/gitorious/pages/DebianSqueezeInstallation


How can I fix it?
--
To post to this group, send email to 
gitorious@googlegroups.commailto:gitorious@googlegroups.com
To unsubscribe from this group, send email to
gitorious+unsubscr...@googlegroups.commailto:gitorious+unsubscr...@googlegroups.com

-- 
To post to this group, send email to gitorious@googlegroups.com
To unsubscribe from this group, send email to
gitorious+unsubscr...@googlegroups.com