Feature #24013

Firebird and RedDatabase support

Added by Andrey Lobanov (RedSoft) about 6 years ago. Updated 6 months ago.

Status:NewStart date:
Priority:LowDue date:
Assignee:-% Done:

0%

Category:Database
Target version:-
Resolution:

Description

I made a patch that adds support for firebird and RedDatabase(based on firebird).
Biggest problem that occurs when trying to run redmine with activerecord-fb-adapter that redmine uses in string constants firebird keywords.

Basic_Fb_support.patch Magnifier (41.8 KB) Andrey Lobanov (RedSoft), 2016-10-06 23:34

Fb_Support_clear.patch Magnifier (31 KB) Andrey Lobanov (RedSoft), 2016-10-07 09:25

firebird_support_v2.patch Magnifier (41.2 KB) Andrey Lobanov (RedSoft), 2016-10-09 16:27

Firebird_support_v3.patch Magnifier (40.6 KB) Andrey Lobanov (RedSoft), 2016-10-10 18:11

issue-24013-r16009-misc.diff Magnifier (18.3 KB) Toshi MARUYAMA, 2016-11-28 14:13

issue-24013-r16009-db-migrate.diff Magnifier (3.61 KB) Toshi MARUYAMA, 2016-11-28 14:13

issue-24013-r16009-keywords.diff Magnifier (10.7 KB) Toshi MARUYAMA, 2016-11-28 14:13

current_trunk_Firebird_and_RedDatabase_support.patch Magnifier (27.7 KB) Andrey Lobanov (RedSoft), 2017-01-23 14:23

current_trunk_Decimal_data_type_fix.patch Magnifier (4.76 KB) Andrey Lobanov (RedSoft), 2017-01-23 15:47

Symbols_instead_of_strings_to_support_firebird_keywords.patch Magnifier (5.95 KB) Andrey Lobanov (RedSoft), 2017-02-14 13:49

Value_keyword_replaced_with_symbols__in_application_controller.patch Magnifier (915 Bytes) Andrey Lobanov (RedSoft), 2017-02-14 13:54

Associated revisions

Revision 16008
Added by Toshi MARUYAMA about 6 years ago

use symbol instead of string for 'position' (#24013)

Revision 16009
Added by Toshi MARUYAMA about 6 years ago

use symbol instead of string for 'position' in db migrate (#24013)

History

#1 Updated by Toshi MARUYAMA about 6 years ago

It is too hard to see difference in patch.
Could you split patch to two patches?

  1. only indent and white space change
  2. main change

#2 Updated by Andrey Lobanov (RedSoft) about 6 years ago

Here is clear patch. These small changes allows redmine work with firebird.

#3 Updated by Toshi MARUYAMA about 6 years ago

Did you run tests and confirm other databases do not break tests?
http://www.redmine.org/builds/index.html

#4 Updated by Andrey Lobanov (RedSoft) about 6 years ago

I'm sorry few tests failed. So i'll fix it and upload only fully working patch.

#5 Updated by Andrey Lobanov (RedSoft) about 6 years ago

New version of patch. Other dbs tests working.

#6 Updated by Toshi MARUYAMA about 6 years ago

From blog written in Japanese:
http://qiita.com/jnchito/items/630b9f038c87298b5756

https://github.com/rails/rails/issues/16978#issuecomment-56211310

First thing, arel_table is private API of Rails and should not be used in applications.

http://bikeshed.fm/74#comment-2830227073

In this podcast I heard Arel is going to be a public API in Rails 5.1, correct? Does that mean Rails developers will be allowed to use it in applications?

I got an answer from Sean:
Yes, it will be stable after 5.1
https://twitter.com/sgrif/status/763830491204026368

#7 Updated by Toshi MARUYAMA about 6 years ago

  • Tracker changed from Patch to Feature
  • Priority changed from Normal to Low

#8 Updated by Andrey Lobanov (RedSoft) about 6 years ago

Oh. I'll change arel_table usage.

#9 Updated by Andrey Lobanov (RedSoft) about 6 years ago

Fixed arel_table usage.

#10 Updated by Mischa The Evil about 6 years ago

For completeness' sake:

Note from quick visual patch scan: it seems it is missing adaptations to the Gemfile, the configuration stubs (config/database.yml.example) and the documentation (doc/INSTALL) reflecting the proposed extension of DB support.

#11 Updated by Warren Postma about 6 years ago

Given that Firebird is an extremely limited and feature-poor alternative to MySQL or Postgres, who would want to use Firebird? I say this as a person with 10 years professional Firebird (and Interbase) experience.

Firebird is itself an open source fork of the Borland/Embarcadero Interbase product.

#12 Updated by Andrey Lobanov (RedSoft) about 6 years ago

Warren Postma wrote:

Given that Firebird is an extremely limited and feature-poor alternative to MySQL or Postgres, who would want to use Firebird? I say this as a person with 10 years professional Firebird (and Interbase) experience.

Firebird is itself an open source fork of the Borland/Embarcadero Interbase product.

I'm sorry but when Firebird became feature-poor? Did you checked latest version 3.0?

#13 Updated by Toshi MARUYAMA about 6 years ago

  • File issue-24103-r16009-misc.diff added
  • File issue-24103-r16009-keywords.diff added
  • File issue-24103-r16009-db-migrate.diff added

These are patches which remained Firebird_support_v3.patch after r16008 and r16009.
I think issue-24013-r16009-db-migrate.diff breaks existing system.

#14 Updated by Toshi MARUYAMA about 6 years ago

Fixed issue number of patch files.

#15 Updated by Toshi MARUYAMA about 6 years ago

  • File deleted (issue-24103-r16009-keywords.diff)

#16 Updated by Toshi MARUYAMA about 6 years ago

  • File deleted (issue-24103-r16009-misc.diff)

#17 Updated by Toshi MARUYAMA about 6 years ago

  • File deleted (issue-24103-r16009-db-migrate.diff)

#18 Updated by Andrey Lobanov (RedSoft) almost 6 years ago

Right now i'm trying to find better solution to support Firebird.
The biggest problem to make it looks native. Because of large count of hardcoded queries with Firebird's keywords.

#19 Updated by Andrey Lobanov (RedSoft) almost 6 years ago

Example of queries changes to fit firebird:
Before:

    JournalDetail.
      where(["property = 'attr' AND prop_key = 'assigned_to_id' AND value = ?", id.to_s]).
      update_all(['value = ?', substitute.id.to_s])

After:
    JournalDetail.
      where(:property => 'attr', :prop_key => 'assigned_to_id', :value => id.to_s).
      update_all(:value => substitute.id.to_s)

Main problem is subqueries or part of queries(where, select, etc) like this:

      # Returns a JOIN clause that is added to the query when sorting by custom values
      def join_for_order_statement(custom_field)
        alias_name = join_alias(custom_field)

        "LEFT OUTER JOIN #{CustomValue.table_name} #{alias_name}" +
          " ON #{alias_name}.customized_type = '#{custom_field.class.customized_class.base_class.name}'" +
          " AND #{alias_name}.customized_id = #{custom_field.class.customized_class.table_name}.id" +
          " AND #{alias_name}.custom_field_id = #{custom_field.id}" +
          " AND (#{custom_field.visibility_by_project_condition})" +
          " AND #{alias_name}.value <> ''" +
          " AND #{alias_name}.id = (SELECT max(#{alias_name}_2.id) FROM #{CustomValue.table_name} #{alias_name}_2" +
            " WHERE #{alias_name}_2.customized_type = #{alias_name}.customized_type" +
            " AND #{alias_name}_2.customized_id = #{alias_name}.customized_id" +
            " AND #{alias_name}_2.custom_field_id = #{alias_name}.custom_field_id)" 
      end


In this code fragment i can't find good solution to replace
#{alias_name}.value

Any suggestions? I'll appreciate any help

#20 Updated by Andrey Lobanov (RedSoft) almost 6 years ago

Here changes to support firebird at actual trunk.

#21 Updated by Andrey Lobanov (RedSoft) almost 6 years ago

Also decimal precision fix

#22 Updated by Andrey Lobanov (RedSoft) almost 6 years ago

I think i forgot about some migration files. But i'll fix that later.

#23 Updated by Andrey Lobanov (RedSoft) almost 6 years ago

Here some fixes to use symbols instead of strings.

#24 Updated by Andrey Lobanov (RedSoft) almost 6 years ago

Value keyword replaced in application_controller

#25 Updated by Lucas Schatz about 3 years ago

Any news about this patch? is it stable? integrated?
It would be nice to use Firebird with Redmine too :)
Thanks!

#26 Updated by Tim Crawford 6 months ago

Warren Postma wrote:

Given that Firebird is an extremely limited and feature-poor alternative to MySQL or Postgres, who would want to use Firebird? I say this as a person with 10 years professional Firebird (and Interbase) experience.

Firebird is itself an open source fork of the Borland/Embarcadero Interbase product.

Just saw this. What?
Firebird is far better than MySql, especially for small systems.
MySql download alone is over 600 MB and takes about 30 minutes minumum to install
Firebird is 15 MB and can be installed in under 5 minutes

I says this as a person who worked for Oracle for 17 years,
and 7 years working with MySql and Firebird

Also available in: Atom PDF