|
1 | 1 | create_file "app/assets/config/manifest.js", skip: true |
2 | 2 |
|
| 3 | +db = ENV['DB'] || 'sqlite' |
| 4 | +case db |
| 5 | +when 'mysql' |
| 6 | + remove_file 'config/database.yml' |
| 7 | + create_file 'config/database.yml', <<~YAML |
| 8 | + default: &default |
| 9 | + adapter: mysql2 |
| 10 | + encoding: utf8mb4 |
| 11 | + pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> |
| 12 | + host: <%= ENV.fetch("DB_HOST", "127.0.0.1") %> |
| 13 | + port: <%= ENV.fetch("DB_PORT", 3306) %> |
| 14 | + username: <%= ENV.fetch("DB_USERNAME", "root") %> |
| 15 | + password: <%= ENV.fetch("DB_PASSWORD", "root") %> |
| 16 | +
|
| 17 | + test: |
| 18 | + <<: *default |
| 19 | + database: active_admin_import_test |
| 20 | + YAML |
| 21 | +when 'postgres', 'postgresql' |
| 22 | + remove_file 'config/database.yml' |
| 23 | + create_file 'config/database.yml', <<~YAML |
| 24 | + default: &default |
| 25 | + adapter: postgresql |
| 26 | + encoding: unicode |
| 27 | + pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> |
| 28 | + host: <%= ENV.fetch("DB_HOST", "127.0.0.1") %> |
| 29 | + port: <%= ENV.fetch("DB_PORT", 5432) %> |
| 30 | + username: <%= ENV.fetch("DB_USERNAME", "postgres") %> |
| 31 | + password: <%= ENV.fetch("DB_PASSWORD", "postgres") %> |
| 32 | +
|
| 33 | + test: |
| 34 | + <<: *default |
| 35 | + database: active_admin_import_test |
| 36 | + YAML |
| 37 | +end |
| 38 | + |
3 | 39 | generate :model, 'author name:string{10}:uniq last_name:string birthday:date --force' |
4 | 40 | generate :model, 'post title:string:uniq body:text request_ip:string author:references --force' |
5 | 41 | generate :model, 'post_comment body:text post:references --force' |
|
19 | 55 |
|
20 | 56 | run 'rm -rf test' |
21 | 57 | route "root :to => 'admin/dashboard#index'" |
22 | | -rake 'db:migrate' |
| 58 | +rake 'db:create db:migrate' |
23 | 59 |
|
24 | 60 | run 'rm -f Gemfile Gemfile.lock' |
0 commit comments