Vote #77877
未完了Firebird and RedDatabase support
0%
説明
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.
journals
It is too hard to see difference in patch.
Could you split patch to two patches?
# only indent and white space change
# main change
--------------------------------------------------------------------------------
Here is clear patch. These small changes allows redmine work with firebird.
--------------------------------------------------------------------------------
Did you run tests and confirm other databases do not break tests?
http://www.redmine.org/builds/index.html
--------------------------------------------------------------------------------
I'm sorry few tests failed. So i'll fix it and upload only fully working patch.
--------------------------------------------------------------------------------
New version of patch. Other dbs tests working.
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Oh. I'll change arel_table usage.
--------------------------------------------------------------------------------
Fixed arel_table usage.
--------------------------------------------------------------------------------
For completeness' sake:
* Upstream ("activerecord-fb-adapter":https://github.com/rowland/activerecord-fb-adapter) issue: https://github.com/rowland/activerecord-fb-adapter/issues/70 (_Problem with db migration_)
* Upstream pull request: https://github.com/rowland/activerecord-fb-adapter/pull/73 (_Redmine support_)
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.
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
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?
--------------------------------------------------------------------------------
These are patches which remained attachment:Firebird_support_v3.patch after r16008 and r16009.
I think attachment:issue-24013-r16009-db-migrate.diff breaks existing system.
--------------------------------------------------------------------------------
Fixed issue number of patch files.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
Example of queries changes to fit firebird:
Before:
<pre><code class="ruby">
JournalDetail.
where(["property = 'attr' AND prop_key = 'assigned_to_id' AND value = ?", id.to_s]).
update_all(['value = ?', substitute.id.to_s])
</code></pre>
After:
<pre><code class="ruby">
JournalDetail.
where(:property => 'attr', :prop_key => 'assigned_to_id', :value => id.to_s).
update_all(:value => substitute.id.to_s)
</code></pre>
Main problem is subqueries or part of queries(where, select, etc) like this:
<pre><code class="ruby">
# 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
</code>
</pre>
In this code fragment i can't find good solution to replace <pre><code class="ruby">#{alias_name}.value
</code></pre>
Any suggestions? I'll appreciate any help
--------------------------------------------------------------------------------
Here changes to support firebird at actual trunk.
--------------------------------------------------------------------------------
Also decimal precision fix
--------------------------------------------------------------------------------
I think i forgot about some migration files. But i'll fix that later.
--------------------------------------------------------------------------------
Here some fixes to use symbols instead of strings.
--------------------------------------------------------------------------------
Value keyword replaced in application_controller
--------------------------------------------------------------------------------
Any news about this patch? is it stable? integrated?
It would be nice to use Firebird with Redmine too :)
Thanks!
--------------------------------------------------------------------------------