[Travis] Test entire suite against MySQL and PostgreSQL
Created by: ariejan
The goal is to support both MySQL and PostgreSQL as back-ends for Gitlab.
Activity
-
Newest first Oldest first
-
Show all activity Show comments only Show history only
- Author Owner
Created by: beddari
Thanks, this is the way to go :-)
By Administrator on 2012-03-15T09:02:34 (imported from GitLab project)
By Administrator on 2012-03-15T09:02:34 (imported from GitLab)
- Author Owner
Created by: ariejan
Postgres is a no-go at this time.
Note
uses a polymorphic association, but thenotable_id
is of typeString
. This is done to accomodate notes on commits (which are not ActiveRecord objects).The problem is that Postgres does not typecast "notable_id = 1" properly. This is not an issue with MySQL and Sqlite3.
If anyone has a good solution for this, please let me know.
By Administrator on 2012-03-16T10:29:38 (imported from GitLab project)
By Administrator on 2012-03-16T10:29:38 (imported from GitLab)
- Author Owner
Created by: ariejan
@randx Do you have an opinion on this?
By Administrator on 2012-03-16T10:31:10 (imported from GitLab project)
By Administrator on 2012-03-16T10:31:10 (imported from GitLab)
- Author Owner
Created by: ariejan
Current status: http://travis-ci.org/#!/ariejan/gitlabhq
By Administrator on 2012-03-16T10:38:34 (imported from GitLab project)
By Administrator on 2012-03-16T10:38:34 (imported from GitLab)
- Author Owner
Created by: dubcanada
polymorphic association are kind of a problem in postgres. Take a quick read through http://blog.metaminded.com/2010/11/25/stable-polymorphic-foreign-key-relations-in-rails-with-postgresql/ it may give some lead way, sadly my postgres knowledge is limited if any at all.
By Administrator on 2012-03-16T15:17:42 (imported from GitLab project)
By Administrator on 2012-03-16T15:17:42 (imported from GitLab)
- Author Owner
Created by: moskvin
I can suggest temporary solution for postgres database. You can add to model of Issue following:
def notes Note.find(:all, :conditions => ["noteable_id = '?'", self.id]) end
and replaced upvotes method the following:
def upvotes count = 0 notes = Note.find(:all, :conditions => ["noteable_id = '?'", self.id]) if notes notes.each do |n| count+=1 if n.upvote? end end count end
I was able do just workaround.
By Administrator on 2012-03-27T19:23:42 (imported from GitLab project)
By Administrator on 2012-03-27T19:23:42 (imported from GitLab)
- Author Owner
Created by: ariejan
@Moskvin that sounds like the way to go. I'd rather do this to keep ARel happy:
def notes Note.where(noteable_id: self.id.to_s, noteable_type: 'Issue') end
Are all the specs green?
By Administrator on 2012-03-27T20:51:27 (imported from GitLab project)
By Administrator on 2012-03-27T20:51:27 (imported from GitLab)
- Author Owner
Created by: moskvin
I used a simple patch and the gitlab to work very well on my server with postgres:
https://gist.github.com/2226604
Should I do any unit tests for you?
By Administrator on 2012-03-28T14:29:49 (imported from GitLab project)
By Administrator on 2012-03-28T14:29:49 (imported from GitLab)
- Author Owner
Created by: moskvin
I got another issue with the postgres database connection via redis. And I created another workaround for fix it: https://gist.github.com/2283919
By Administrator on 2012-04-02T14:43:48 (imported from GitLab project)
By Administrator on 2012-04-02T14:43:48 (imported from GitLab)
- Author Owner
Created by: qbrossard
I would be glad to help with postgresql support. Is somebody working on that? Should I try to collect all the patches mentioned here and work on getting the test suite green?
Regards
Quentin
By Administrator on 2012-05-11T09:56:22 (imported from GitLab project)
By Administrator on 2012-05-11T09:56:22 (imported from GitLab)
- Author Owner
Created by: moskvin
I tested above patches on my production server and it running on postgres server. Currently I do not do nothing for this issue
By Administrator on 2012-05-11T10:13:50 (imported from GitLab project)
By Administrator on 2012-05-11T10:13:50 (imported from GitLab)
- Author Owner
Created by: ariejan
@qbrossard Please get it to green! See @Moskvin's patch to see if you can use it.
By Administrator on 2012-05-11T11:35:08 (imported from GitLab project)
By Administrator on 2012-05-11T11:35:08 (imported from GitLab)
- Author Owner
Created by: dzaporozhets
+1. Waiting for PR
By Administrator on 2012-05-24T08:57:59 (imported from GitLab project)
By Administrator on 2012-05-24T08:57:59 (imported from GitLab)
- Author Owner
Created by: funny-falcon
Is it possible to add conditional migration and execute following if database is PostgreSQL:
CREATE CAST (integer AS text) WITH INOUT AS IMPLICIT;
May be just ingnoring exceptions, like that:
class FixPostgresqlMigration < ActiveRecord::Migration def up execute <<-SQL CREATE CAST (integer AS text) WITH INOUT AS IMPLICIT; SQL rescue ActiveRecord::StatementInvalid end def down end end
By Administrator on 2012-06-22T10:55:17 (imported from GitLab project)
By Administrator on 2012-06-22T10:55:17 (imported from GitLab)
- Author Owner
Created by: denispeplin
Migrations is broken for Postgresql, look at #1017
And there are other issues with Postgresql and Redis: #1015 (closed)
By Administrator on 2012-06-29T18:25:46 (imported from GitLab project)
By Administrator on 2012-06-29T18:25:46 (imported from GitLab)
- Author Owner
Created by: MSch
So the noteable_id is fixed and only the redis issues still remain?
By Administrator on 2012-07-03T15:40:00 (imported from GitLab project)
By Administrator on 2012-07-03T15:40:00 (imported from GitLab)
- Author Owner
Created by: moskvin
I found issue with connection to postgres via resque. I can suggest following solution https://gist.github.com/3040672
By Administrator on 2012-07-03T16:06:14 (imported from GitLab project)
By Administrator on 2012-07-03T16:06:14 (imported from GitLab)
- Author Owner
Created by: denispeplin
@Moskvin, your patch works perfect, thanks!
By Administrator on 2012-07-05T11:01:00 (imported from GitLab project)
By Administrator on 2012-07-05T11:01:00 (imported from GitLab)
- Author Owner
Created by: dzaporozhets
cause postgres support requires too much hack of code we can live w/o it
By Administrator on 2012-10-09T08:31:06 (imported from GitLab project)
By Administrator on 2012-10-09T08:31:06 (imported from GitLab)
- Author Owner
Created by: zzet
Testing MySQL && PostgreSQL added in #1666
By Administrator on 2012-10-10T11:56:20 (imported from GitLab project)
By Administrator on 2012-10-10T11:56:20 (imported from GitLab)