Sign inSign up

singingcode/standalone-migrations

By singingcode

•Updated over 8 years ago

Container Docker to run Active Record 5 migrations without a Rails application.

Image
0

10K+

singingcode/standalone-migrations repository overview

⁠Create a docker-compose.yml on your project
migrate:
  image: webgoal/standalone-migrations
  volumes:
    - ./db:/opt/migrations/db

As in the example you must have a 'db' folder in the same directory

⁠Create a config.yml inside the 'db' folder
development:
  adapter: mysql2
  encoding: utf8
  database: database_development
  username: user
  password: pass
  host: 192.168.1.2

production:
  adapter: mysql2
  encoding: utf8
  database: database_production
  username: user
  password: pass
  host: 192.168.1.3
⁠Restore an existing database
docker-compose run db mysql -hdb -pmypass database_development < ./db/structure.sql
⁠Create a new migration
docker-compose run migrate rake db:new_migration name="migration_name"
⁠Run migrations
docker-compose run migrate rake db:migrate
⁠Run migrations in production
docker-compose run -e RAILS_ENV='production' migrate rake db:migrate

Tag summary

Content type

Image

Digest

Size

318.8 MB

Last updated

over 8 years ago

docker pull singingcode/standalone-migrations