Created
October 10, 2014 21:39
-
-
Save MMcM/16092e62739b69ddb046 to your computer and use it in GitHub Desktop.
disapora* on FoundationDB SQL layer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql: &mysql | |
adapter: mysql2 | |
host: "localhost" | |
port: 3306 | |
username: "root" | |
password: "" | |
# socket: /tmp/mysql.sock | |
charset: utf8 | |
collation: utf8_bin | |
postgres: &postgres | |
adapter: postgresql | |
host: localhost | |
port: 5432 | |
username: postgres | |
password: | |
encoding: unicode | |
fdbsql: &fdbsql | |
adapter: fdbsql | |
host: localhost | |
port: 15432 | |
username: diaspora | |
# Comment the the mysql line and uncomment the postgres line | |
# if you want to use postgres | |
common: &common | |
# Choose one of the following | |
#<<: *mysql | |
#<<: *postgres | |
<<: *fdbsql | |
# Should match environment.sidekiq.concurrency | |
#pool: 25 | |
################################################## | |
#### CONFIGURE ABOVE ############################# | |
################################################## | |
# Normally you don't need to touch anything here | |
postgres_travis: &postgres_travis | |
adapter: postgresql | |
username: postgres | |
combined: &combined | |
<<: *common | |
development: | |
<<: *combined | |
database: diaspora_development | |
production: | |
<<: *combined | |
database: diaspora_production | |
test: | |
<<: *combined | |
database: "diaspora_test" | |
integration1: | |
<<: *combined | |
database: diaspora_integration1 | |
integration2: | |
<<: *combined | |
database: diaspora_integration2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Gemfile b/Gemfile | |
index 678a5d2..d5748b4 100644 | |
--- a/Gemfile | |
+++ b/Gemfile | |
@@ -56,6 +56,7 @@ ENV['DB'] ||= 'mysql' | |
gem 'mysql2', '0.3.16' if ENV['DB'] == 'all' || ENV['DB'] == 'mysql' | |
gem 'pg', '0.17.1' if ENV['DB'] == 'all' || ENV['DB'] == 'postgres' | |
+gem 'activerecord-fdbsql-adapter', github: 'FoundationDB/sql-layer-adapter-activerecord' if ENV['DB'] == 'all' || ENV['DB'] == 'fdbsql' | |
gem 'activerecord-import', '0.5.0' | |
gem 'foreigner', '1.6.1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/models/user/querying.rb b/app/models/user/querying.rb | |
index e10fbe0..10abd12 100644 | |
--- a/app/models/user/querying.rb | |
+++ b/app/models/user/querying.rb | |
@@ -39,7 +39,7 @@ module User::Querying | |
shareable_from_others = construct_shareable_from_others_query(opts) | |
shareable_from_self = construct_shareable_from_self_query(opts) | |
- "(#{shareable_from_others.to_sql} LIMIT #{opts[:limit]}) UNION ALL (#{shareable_from_self.to_sql} LIMIT #{opts[:limit]}) ORDER BY #{opts[:order]} LIMIT #{opts[:limit]}" | |
+ "SELECT id,updated_at,created_at FROM (#{shareable_from_others.to_sql} LIMIT #{opts[:limit]}) t1 UNION ALL SELECT id,updated_at,created_at FROM (#{shareable_from_self.to_sql} LIMIT #{opts[:limit]}) t2 ORDER BY #{opts[:order]} LIMIT #{opts[:limit]}" | |
end | |
def ugly_select_clause(query, opts) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment