Skip to content
Browse files

Make the app run on PostgreSQL.

  • Loading branch information...
1 parent b74475b commit 5f294a7c9f39d3347b73c426ad196be14a610fae @Manfred Manfred committed Jul 22, 2011
Showing with 14 additions and 42 deletions.
  1. +1 −1 Gemfile
  2. +2 −2 Gemfile.lock
  3. +1 −1 app/controllers/application_controller.rb
  4. +0 −2 app/models/member.rb
  5. +8 −34 config/database.yml
  6. +1 −1 db/seeds.rb
  7. +1 −1 lib/batched.rb
View
2 Gemfile
@@ -2,7 +2,7 @@ source 'http://rubygems.org'
gem 'rails', '3.0.9'
-gem 'mysql2', '~> 0.2.6'
+gem 'pg'
gem 'twitter_oauth', '~> 0.4.3'
gem 'authorization-san', '~> 2.0.1', :require => 'authorization'
gem 'peiji-san', '~> 1.0.0', :require => 'peiji_san'
View
4 Gemfile.lock
@@ -59,11 +59,11 @@ GEM
mocha (0.9.12)
multi_json (1.0.3)
multipart-post (1.1.2)
- mysql2 (0.2.11)
net-ssh (2.0.24)
oauth (0.4.5)
on-test-spec (0.3.0)
peiji-san (1.0.0)
+ pg (0.10.1)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.14)
@@ -109,9 +109,9 @@ DEPENDENCIES
authorization-san (~> 2.0.1)
flying-sphinx (= 0.5.0)
mocha
- mysql2 (~> 0.2.6)
on-test-spec
peiji-san (~> 1.0.0)
+ pg
rails (= 3.0.9)
test-spec
thinking-sphinx (= 2.0.4)
View
2 app/controllers/application_controller.rb
@@ -7,7 +7,7 @@ class ApplicationController < ActionController::Base
def find_authenticated
if id = session[:twitter_id]
- @authenticated = Member.find_by_twitter_id(id)
+ @authenticated = Member.find_by_twitter_id(id.to_s)
end
end
View
2 app/models/member.rb
@@ -59,8 +59,6 @@ class Member < ActiveRecord::Base
has :available_for_hire, :as => :boolean
where "marked_as_spam = 'false'"
-
- set_property :group_concat_max_len => 8192
end
# The default scope will ensure that members marked as spam will never show
View
42 config/database.yml
@@ -1,40 +1,14 @@
-# MySQL. Versions 4.1 and 5.0 are recommended.
-#
-# Install the MySQL driver:
-# gem install mysql2
-#
-# And be sure to use new-style password hashing:
-# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
- adapter: mysql2
- encoding: utf8
- reconnect: false
+ adapter: postgresql
+ encoding: unicode
database: appsterdam_development
pool: 5
- username: root
- password:
- host: localhost
-
-# Warning: The database defined as "test" will be erased and
-# re-generated from your development database when you run "rake".
-# Do not set this db to the same as development or production.
+ username: <%= ENV['USER'] %>
+ min_messages: warning
test:
- adapter: mysql2
- encoding: utf8
- reconnect: false
+ adapter: postgresql
+ encoding: unicode
database: appsterdam_test
pool: 5
- username: root
- password:
- host: localhost
-
-production:
- adapter: mysql2
- encoding: utf8
- reconnect: false
- database: appsterdam_production
- pool: 5
- username: root
- password:
- host: localhost
-
+ username: <%= ENV['USER'] %>
+ min_messages: warning
View
2 db/seeds.rb
@@ -9,7 +9,7 @@ def add_work_type(member, type)
list = JSON.parse(File.read(file))
users = list['users']
users.each do |attributes|
- member = Member.find_by_twitter_id(attributes['id']) ||
+ member = Member.find_by_twitter_id(attributes['id'].to_s) ||
Member.create_with_twitter_user_attributes(attributes)
case list_name
when 'companies'
View
2 lib/batched.rb
@@ -2,7 +2,7 @@ module Batched
DEFAULT_BATCH_SIZE = 512
def _max_id
- connection.execute("SELECT MAX(id) FROM #{table_name}").first[0]
+ connection.execute("SELECT MAX(id) FROM #{table_name}")[0]['max'].to_i
end
def _ids_in_batch(batch_size, index)

0 comments on commit 5f294a7

Please sign in to comment.
Something went wrong with that request. Please try again.