mirror of
				https://github.com/fspc/BikeShed-1.git
				synced 2025-10-31 00:45:35 -04:00 
			
		
		
		
	Switch DB from sqlite to Postgres
-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 .example
This commit is contained in:
		
							parent
							
								
									238a3af7d5
								
							
						
					
					
						commit
						f0ce8b7171
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -8,3 +8,4 @@ tmp/ | ||||
| .DS_Store | ||||
| public/extjs | ||||
| public/images/icons | ||||
| config/database.yml | ||||
|  | ||||
							
								
								
									
										2
									
								
								Gemfile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Gemfile
									
									
									
									
									
								
							| @ -14,7 +14,7 @@ gem 'decent_exposure', '~> 1.0.1' | ||||
| gem 'devise', '~> 2.0.4' | ||||
| gem 'haml-rails', '~> 0.3.4' | ||||
| gem 'jquery-rails', '~> 2.0' | ||||
| gem 'sqlite3', '~> 1.3.5' | ||||
| gem 'pg' | ||||
| gem 'will_paginate', '~> 3.0.3' | ||||
| 
 | ||||
| # Gems used only for assets and not required | ||||
|  | ||||
| @ -133,6 +133,7 @@ GEM | ||||
|       uglifier | ||||
|     nokogiri (1.5.9) | ||||
|     orm_adapter (0.0.7) | ||||
|     pg (0.15.1) | ||||
|     polyglot (0.3.3) | ||||
|     pry (0.9.12) | ||||
|       coderay (~> 1.0.5) | ||||
| @ -191,7 +192,6 @@ GEM | ||||
|       multi_json (~> 1.0) | ||||
|       rack (~> 1.0) | ||||
|       tilt (~> 1.1, != 1.3.0) | ||||
|     sqlite3 (1.3.7) | ||||
|     therubyracer (0.10.2) | ||||
|       libv8 (~> 3.3.10) | ||||
|     thor (0.18.1) | ||||
| @ -239,13 +239,13 @@ DEPENDENCIES | ||||
|   netzke-basepack (~> 0.8.0) | ||||
|   netzke-cancan | ||||
|   netzke-core (~> 0.8.0) | ||||
|   pg | ||||
|   pry (~> 0.9.8) | ||||
|   rails (= 3.2.13) | ||||
|   rb-fsevent | ||||
|   rspec-rails (~> 2.8.1) | ||||
|   shoulda-matchers (~> 1.0.0) | ||||
|   spork | ||||
|   sqlite3 (~> 1.3.5) | ||||
|   turnip (~> 0.3.0) | ||||
|   twitter-bootstrap-rails (~> 2.0.3) | ||||
|   uglifier (>= 1.0.3) | ||||
|  | ||||
							
								
								
									
										17
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								README.md
									
									
									
									
									
								
							| @ -4,18 +4,29 @@ | ||||
| 1. allow the .rvmrc file | ||||
| 1. `gem install bundler` | ||||
| 1. `bundle` | ||||
| 1. Install Postgres (Mac OSX instructions below) | ||||
| 1. `rake db:create db:migrate` | ||||
| 1. `rake db:seed` | ||||
| 1. Download extJS 4.1 (A version of 4.1 is hosted here: http://my.jasondenney.com/extjs-4.1.1.zip) Latest versions at http://www.sencha.com/products/extjs. Unzip and place where ever you like. | ||||
| 1. Link to your extJS folder path under `public/extjs`: (From app root) `ln -s /MY/PATH/extjs/ public/extjs` | ||||
| 1. `rails s` | ||||
| 
 | ||||
| 
 | ||||
| # Postgres 9.2 Mac OSX Install | ||||
| 1. Install homebrew `ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"` | ||||
| 1. `brew install postgres` | ||||
| 1. First time db initialization `initdb /usr/local/var/postgres -E utf8` | ||||
| 1. Start Postgres `pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start` | ||||
| 1. Create your PG user `createuser -d -P velocipede` | ||||
| 1. Create your database `createdb -U velocipede --owner=velocipede velocipede` | ||||
| 1. Copy over DB config:  `cp config/database.yml.example config/database.yml` | ||||
| 1. Update config with your database (velocipede), user (velocipede), and password. | ||||
| 
 | ||||
| # Optional | ||||
|  Add icons | ||||
|   | ||||
| 1. Download icons from http://www.famfamfam.com/lab/icons/silk/ | ||||
| 1. Link to the icons under `public/images/icons`: (From app root) `ln -s /MY/PATH/famfamfam_silk_icons/icons public/images/icons`  | ||||
| 
 | ||||
| 1. Download icons from http://www.famfamfam.com/lab/icons/silk/ | ||||
| 1. Link to the icons under `public/images/icons`: (From app root) `ln -s /MY/PATH/famfamfam_silk_icons/icons public/images/icons` | ||||
| 
 | ||||
| ## Mailcatcher | ||||
| 
 | ||||
|  | ||||
| @ -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 | ||||
							
								
								
									
										23
									
								
								config/database.yml.example
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								config/database.yml.example
									
									
									
									
									
										Normal file
									
								
							| @ -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 | ||||
| @ -2,6 +2,5 @@ class AddEndsToUserRoles < ActiveRecord::Migration | ||||
|   def change | ||||
|     add_column(:user_roles, :ends, :timestamp) | ||||
|     add_column(:user_roles, :user_id, :integer) | ||||
|     remove_column(:users, :role_id) | ||||
|   end | ||||
| end | ||||
|  | ||||
| @ -1,9 +1,23 @@ | ||||
| class AlterUserRoles < ActiveRecord::Migration | ||||
|   def change | ||||
|   def up | ||||
|     rename_table :user_roles, :user_role_joins | ||||
|     change_table :user_role_joins do |t| | ||||
|       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 | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| class RemoveNickname < ActiveRecord::Migration | ||||
|   def change | ||||
|     remove_column :users, :nickname, :string | ||||
|     remove_column :users, :nickname | ||||
|   end | ||||
| end | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user