Skip to content

Commit

Permalink
Merge pull request #25 from hintmedia/fix/handle-new-apps
Browse files Browse the repository at this point in the history
handle new apps with no schema.rb or structure.sql
  • Loading branch information
Nate Vick authored Jul 28, 2020
2 parents bd409a4 + ca5d964 commit 918fb19
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Deprecated
### Removed
### Fixed
- handle new apps with no schema.rb or structure.sql [I22](https://github.com/hintmedia/railsdock/issues/22) [PR25](https://github.com/hintmedia/railsdock/pull/25)
### Security

## [0.3.1] - 07-20-2020
Expand Down
8 changes: 5 additions & 3 deletions lib/railsdock/templates/install/default/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function lock_setup { mkdir -p $APP_TEMP_PATH && touch $APP_SETUP_LOCK; }
function unlock_setup { rm -rf $APP_SETUP_LOCK; }
function wait_setup { echo "Waiting for app setup to finish..."; sleep $APP_SETUP_WAIT; }
function check_host { ping -q -c1 $HOST_DOMAIN > /dev/null 2>&1; }
function schema_file_exists { [[ -e "db/schema.rb" || -e "db/structure.sql" ]]; }

# 2: 'Unlock' the setup process if the script exits prematurely:
trap unlock_setup HUP INT QUIT KILL TERM EXIT
Expand Down Expand Up @@ -41,9 +42,10 @@ then

yarn install
# 9: Setup the database if it doesn't
if ! rake db:version
then
rake db:setup
if ! schema_file_exists; then
bundle exec rake db:create && bundle exec rake db:migrate
elif ! rake db:migrate 2> /dev/null; then
bundle exec rake db:setup
fi

# check if the docker host is running on mac or windows
Expand Down

0 comments on commit 918fb19

Please sign in to comment.