postgresql compatibility
Created by: jozefvaclavik
I dont run MySQL in production. I was running gitlab with Sqlite and I have other apps running PostgreSQL, so I migrated my gitlab db there.
During Note queries gitlab crashes. The problem is that notable_id is type string
#db/schema.rb
  create_table "notes", :force => true do |t|
    t.text     "note"
    t.string   "noteable_id"
    t.string   "noteable_type"
    t.integer  "author_id"
    t.datetime "created_at",    :null => false
    t.datetime "updated_at",    :null => false
    t.integer  "project_id"
    t.string   "attachment"
    t.string   "line_code"
  endIf I want to list issues, it always crash with this error:
ActionView::Template::Error (PG::Error: ERROR:  operator does not exist: character varying = integer
LINE 1: ...OUNT(*) FROM "notes"  WHERE "notes"."noteable_id" = 1 AND "n...
                                                             ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
: SELECT COUNT(*) FROM "notes"  WHERE "notes"."noteable_id" = 1 AND "notes"."noteable_type" = 'Issue'):
    8:         %i.icon-tag
    9:         = label.name
    10:     - if issue.notes.any?
    11:       %span.btn.small.disabled.grouped
    12:         %i.icon-comment
    13:         = issue.notes.count
    14:     - if can? current_user, :modify_issue, issue
  app/views/issues/_show.html.haml:11:in `_app_views_issues__show_html_haml__4204629861026802996_29641400'
  app/views/issues/_issues.html.haml:2:in `block in _app_views_issues__issues_html_haml__1440201310527625046_31074860'
  app/views/issues/_issues.html.haml:1:in `_app_views_issues__issues_html_haml__1440201310527625046_31074860'
  app/views/issues/index.html.haml:59:in `_app_views_issues_index_html_haml___1391241433070931356_55924840'
  app/controllers/issues_controller.rb:23:in `index'Postgres doesn't like that notable_id is string and its trying to search by integer.