Skip to content
This repository has been archived by the owner on Mar 10, 2018. It is now read-only.

Commit

Permalink
Configure databases. Official support for MySQL and PostgreSQL.
Browse files Browse the repository at this point in the history
  • Loading branch information
fnando committed Oct 10, 2015
1 parent fc77508 commit fc4950d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ rvm:
- '2.2'

addons:
postgresql: '9.3'
postgresql: '9.4'

before_script:
- psql -c 'create database coupons_test;' -U postgres
- mysql -e 'create database coupons_test;' -u root

env:
- DATABASE_URL=postgres://postgres@localhost/coupons_test
- 'DATABASE_URL=postgres://postgres@localhost/coupons_test'
- 'DATABASE_URL=mysql2://root@localhost/coupons_test'

gemfile:
- Gemfile
Expand Down
5 changes: 5 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

mysqladmin -u root drop coupons_test --force &> /dev/null
mysqladmin -u root create coupons_test --default-character-set=utf8
dropdb coupons_test &> /dev/null; createdb coupons_test
1 change: 0 additions & 1 deletion coupons.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rspec-rails'
spec.add_development_dependency 'codeclimate-test-reporter'
spec.add_development_dependency 'pry-meta'
spec.add_development_dependency 'sqlite3'
spec.add_development_dependency 'mysql2', '~> 0.3.13'
spec.add_development_dependency 'generator_spec'
spec.add_development_dependency 'database_cleaner'
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/config/database.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test:
url: <%= ENV.fetch('DATABASE_URL', "sqlite3://#{File.expand_path('../spec/db/test.sqlite3', __FILE__)}") %>
url: "<%= ENV.fetch('DATABASE_URL', 'postgres:///coupons_test') %>"
5 changes: 0 additions & 5 deletions spec/support/active_record.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
system 'rm spec/db/test.sqlite3 &> /dev/null'
system 'mysqladmin -u root drop coupons_test --force &> /dev/null'
system 'mysqladmin -u root create coupons_test --default-character-set=utf8'
system 'dropdb coupons_test &> /dev/null; createdb coupons_test'

ActiveRecord::Migrator.migrations_paths << File.expand_path('../db/migrate', __FILE__)
ActiveRecord::Migrator.migrations_paths << File.expand_path('../../db/migrate', __FILE__)
ActiveRecord::Migrator.migrate(ActiveRecord::Migrator.migrations_paths)
Expand Down

0 comments on commit fc4950d

Please sign in to comment.