#!/bin/bash

docker-compose exec -T cassandra ./wait-for-it
docker-compose exec -T dynamodb ./wait-for-it
for keyspace in auditors global_lookups page_views; do
  docker-compose exec -T cassandra cqlsh -e "CREATE KEYSPACE ${keyspace} WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };"
done

(docker-compose exec -T web bundle exec rails db:create db:migrate > /tmp/possible_migration_error.txt 2>&1; cat /tmp/possible_migration_error.txt) && rm /tmp/possible_migration_error.txt
docker-compose exec -T web script/rails runner "require 'switchman/test_helper'; Switchman::TestHelper.recreate_persistent_test_shards"

#!/bin/bash

docker-compose exec -T cassandra ./wait-for-it
docker-compose exec -T dynamodb ./wait-for-it
for keyspace in auditors global_lookups page_views; do
  docker-compose exec -T cassandra cqlsh -e "CREATE KEYSPACE IF NOT EXISTS ${keyspace} WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };"
done

(docker-compose exec -T web bundle exec rails db:create db:migrate > /tmp/possible_migration_error.txt 2>&1; cat /tmp/possible_migration_error.txt) && rm /tmp/possible_migration_error.txt
docker-compose exec -T web script/rails runner "require 'switchman/test_helper'; Switchman::TestHelper.recreate_persistent_test_shards"

Fix cassandra build step for cached image
Fix cassandra build step for cached image

Closes: CCI-107

test plan:
- build passes when using the cached cassandra image
  (i.e. the keyspace already exists)

Change-Id: I0df0a1ff141acd4a30091f544b1058b24163dfba
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/218041
Reviewed-by: Rex Fleischer <360d56e185853f069087eaa5288d1374fc56d750@instructure.com>
Reviewed-by: S. Jacob Powell <03c892efa7d90f6161831192fc2bb1ab9ff2d4d9@instructure.com>
Tested-by: Service Cloud Jenkins <9144042a601061f88f1e1d7a1753ea3e2972119d@instructure.com>
Tested-by: Jenkins
QA-Review: Derek Bender <d24d8a7ee520e34b1cec38800225d9f36b552df7@instructure.com>
Product-Review: Derek Bender <d24d8a7ee520e34b1cec38800225d9f36b552df7@instructure.com>
