kubitron / redmine_git_hosting

A ChiliProject/Redmine plugin which makes configuring your own git hosting easy.
78 stars 15 forks source link

With postgresql 9.0 and 9.1, redmine_git_hosting fails DB migration. #88

Closed crocket closed 12 years ago

crocket commented 12 years ago

I installed the latest redmine_git_hosting and chiliproject 3.3.0.

2012-10-25 00:13:33.165 KST [unknown] chiliprojectDEBUG: building index "index_projects_on_identifier" on table "projects" 2012-10-25 00:13:33.165 KST [unknown] chiliprojectSTATEMENT: CREATE INDEX "index_projects_on_identifier" ON "projects" ("identifier") 2012-10-25 00:13:33.229 KST [unknown] chiliprojectERROR: column "identifier" does not exist 2012-10-25 00:13:33.229 KST [unknown] chiliprojectSTATEMENT: CREATE INDEX "index_repositories_on_identifier" ON "repositories" ("identifier") 2012-10-25 00:13:33.232 KST [unknown] chiliprojectERROR: current transaction is aborted, commands ignored until end of transaction block

In both postgresql and mysql, "repositories" table doesn't have "identifier" column. mysql2 adapter ignored this issue, but pg adapter generated an error for the missing column.

crocket commented 12 years ago

Please refer to https://github.com/crocket/redmine_git_hosting/commits/postgresql for the working patch.

kubitron commented 12 years ago

Wait -- so projects don't have an identifier in ChiliProject 3.3.0?

That is a major bug. Did they used to have identifiers?

kubitron commented 12 years ago

Can you tell me exactly what you did that (1) failed with ChiliProject + postgresql and (2) succeeded with mysql?

Did you install from scratch?

kubitron commented 12 years ago

Ok. The code that you removed in your patch should catch the failure with the rescue. I'm assuming that postgresql doesn't provide an exception to Ruby?

crocket commented 12 years ago

Sorry, I interpreted the error log in the opposite order. I modified the description of this issue accordingly.

The relevant log lines are 2012-10-25 00:13:33.229 KST [unknown] chiliprojectERROR: column "identifier" does not exist 2012-10-25 00:13:33.229 KST [unknown] chiliprojectSTATEMENT: CREATE INDEX "index_repositories_on_identifier" ON "repositories" ("identifier").

The error appears first, and the query that caused the error appears after that.

If you read my code, you'd know that "repositories" table doesn't have "identifier" column.

mysql2 ruby adapter(configured in chiliproject-3.3.0/config/database.yml) somehow ignored this issue, but pg adapter didn't miss it and generated an error.

And since I'm not a ruby programmer, I didn't know what rescue did, and I just removed begin, resuce, and end.

kubitron commented 12 years ago

OK. We cannot change the code as you suggest, since Redmine 1.4 does have repositories with identifiers.

Can you try going back to the original code and replace:

rescue

with

rescue Exception

And let me know if this works...? My hope is that the postgresql db connector is just yielding non-standard errors.

kubitron commented 12 years ago

Ok. Ignore that.

Turns out that Postgresql is a bit problematic. If you would, could you try my 'testing' branch? There is a new version of that migration that should be more Postgresql frendly....

kubitron commented 12 years ago

@crocket, can you try the patch in the testing branch? I really want to close this out (and probably increment the version to 0.5.1x, since I think that this would be a good point to stop).

kubitron commented 12 years ago

Actually -- I'm moving this to the master branch, since there may be others running into this problem (would happen for pre-Redmine 1.4 folks using PostGreSQL as well). Please let me know when you have tried it, so that I can be absolutely sure it is fixed for you....!

crocket commented 12 years ago

The testing branch works with postgresql well. Please merge it to the master branch.

kubitron commented 12 years ago

Great. I'm going to close this bug. Please use the master branch now.