Selaa lähdekoodia

Create and migrate database

tags/v1.0.0
Benjamin Neff 7 vuotta sitten
vanhempi
commit
9cf378625f
No account linked to committer's email address
1 muutettua tiedostoa jossa 27 lisäystä ja 0 poistoa
  1. +27
    -0
      diaspora/install.sls

+ 27
- 0
diaspora/install.sls Näytä tiedosto

@@ -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…
Peruuta
Tallenna