소스 검색

Create and migrate database

tags/v1.0.0
Benjamin Neff 7 년 전
부모
커밋
9cf378625f
No account linked to committer's email address
1개의 변경된 파일27개의 추가작업 그리고 0개의 파일을 삭제
  1. +27
    -0
      diaspora/install.sls

+ 27
- 0
diaspora/install.sls 파일 보기

@@ -103,3 +103,30 @@ diaspora_bundle_install:
- RAILS_ENV: {{ diaspora.environment }}
- require:
- git: diaspora_git

diaspora_create_database:
cmd.run:
- name: rvm ruby-{{ diaspora.ruby_version }}@diaspora do bin/rake db:create db:schema:load
- runas: diaspora
- cwd: {{ diaspora.install_path }}
- onlyif: rvm ruby-{{ diaspora.ruby_version }}@diaspora do bin/rails runner "ActiveRecord::Base.connection" |& grep "database \"{{ diaspora.database.database }}\" does not exist (ActiveRecord::NoDatabaseError)"
- env:
- RAILS_ENV: {{ diaspora.environment }}
- require:
- file: {{ diaspora.install_path }}/config/database.yml
- file: {{ diaspora.install_path }}/config/diaspora.yml
- onchanges:
- git: diaspora_git

diaspora_migrate_database:
cmd.run:
- name: rvm ruby-{{ diaspora.ruby_version }}@diaspora do bin/rake db:migrate
- runas: diaspora
- cwd: {{ diaspora.install_path }}
- onlyif: rvm ruby-{{ diaspora.ruby_version }}@diaspora do bin/rake db:migrate:status | grep -oE "^\s+down"
- env:
- RAILS_ENV: {{ diaspora.environment }}
- require:
- cmd: diaspora_create_database
- onchanges:
- git: diaspora_git

Loading…
취소
저장