mirror of https://github.com/fspc/BikeShed-1.git
Browse Source
-Postgres for production -Migrations don't translate well between sqlite and postgres, better to just develop using the same database as production. -Fixed migrations to work with Postgres -Updated Readme for PG install instructions -database config moved to .exampleeperez-timeinput
Jason Denney
12 years ago
9 changed files with 58 additions and 35 deletions
@ -1,25 +0,0 @@ |
|||||
# SQLite version 3.x |
|
||||
# gem install sqlite3 |
|
||||
# |
|
||||
# Ensure the SQLite 3 gem is defined in your Gemfile |
|
||||
# gem 'sqlite3' |
|
||||
development: |
|
||||
adapter: sqlite3 |
|
||||
database: db/development.sqlite3 |
|
||||
pool: 5 |
|
||||
timeout: 5000 |
|
||||
|
|
||||
# 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. |
|
||||
test: |
|
||||
adapter: sqlite3 |
|
||||
database: db/test.sqlite3 |
|
||||
pool: 5 |
|
||||
timeout: 5000 |
|
||||
|
|
||||
production: |
|
||||
adapter: sqlite3 |
|
||||
database: db/production.sqlite3 |
|
||||
pool: 5 |
|
||||
timeout: 5000 |
|
@ -0,0 +1,23 @@ |
|||||
|
development: |
||||
|
adapter: postgresql |
||||
|
database: velocipede |
||||
|
username: velocipede |
||||
|
password: |
||||
|
host: 127.0.0.1 |
||||
|
|
||||
|
# 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. |
||||
|
test: |
||||
|
adapter: postgresql |
||||
|
database: velocipede |
||||
|
username: velocipede |
||||
|
password: |
||||
|
host: 127.0.0.1 |
||||
|
|
||||
|
production: |
||||
|
adapter: postgresql |
||||
|
database: velocipede |
||||
|
username: velocipede |
||||
|
password: |
||||
|
host: 127.0.0.1 |
@ -1,9 +1,23 @@ |
|||||
class AlterUserRoles < ActiveRecord::Migration |
class AlterUserRoles < ActiveRecord::Migration |
||||
def change |
def up |
||||
rename_table :user_roles, :user_role_joins |
rename_table :user_roles, :user_role_joins |
||||
change_table :user_role_joins do |t| |
change_table :user_role_joins do |t| |
||||
t.rename :role, :role_id |
t.rename :role, :role_id |
||||
t.change :role_id, :integer |
#t.change :role_id, :integer |
||||
|
end |
||||
|
#for Postgres |
||||
|
connection.execute(%q{ |
||||
|
alter table user_role_joins |
||||
|
alter column role_id |
||||
|
type integer using cast(role_id as integer) |
||||
|
}) |
||||
|
end |
||||
|
|
||||
|
def down |
||||
|
rename_table :user_role_joins, :user_roles |
||||
|
change_table :user_role_joins do |t| |
||||
|
t.rename :role_id, :role |
||||
|
t.change :role_id, :string |
||||
end |
end |
||||
end |
end |
||||
end |
end |
||||
|
@ -1,5 +1,5 @@ |
|||||
class RemoveNickname < ActiveRecord::Migration |
class RemoveNickname < ActiveRecord::Migration |
||||
def change |
def change |
||||
remove_column :users, :nickname, :string |
remove_column :users, :nickname |
||||
end |
end |
||||
end |
end |
||||
|
Loading…
Reference in new issue