Skip to content

Commit

Permalink
Add teardown_mssql
Browse files Browse the repository at this point in the history
  • Loading branch information
sassela committed Jun 17, 2021
1 parent 5d938fd commit 2d11e11
Show file tree
Hide file tree
Showing 4 changed files with 209 additions and 2 deletions.
1 change: 0 additions & 1 deletion containers/mssql-seed-chinook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SEEDFILE=$SCRIPT_DIR/Chinook_SqlServer.sql
METADATA_URL=http://localhost:8085/v1/metadata
MSSQL_DB_URL="DRIVER={ODBC Driver 17 for SQL Server};SERVER=msserver;Uid=SA;Pwd=testPassword123"
MSSQL_CMD="sqlcmd -S $MSSQLADDRESS -U $MSSQLUSER -P $MSSQLPASS"

function mssql_wait {
echo -n "Waiting for mssql to come up"
Expand Down
10 changes: 10 additions & 0 deletions containers/mssql-teardown-chinook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# SCRIPT_DIR points to the absolute path of this file
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
METADATA_URL=http://localhost:8085/v1/metadata

echo ""
echo "Untracking tables"
curl "$METADATA_URL" --data-binary "@$SCRIPT_DIR/mssql_untrack_chinook_tables.json"
echo ""
193 changes: 193 additions & 0 deletions containers/mssql_untrack_chinook_tables.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
{
"type": "bulk",
"source": "mssql",
"args": [
{
"type": "mssql_untrack_table",
"args": {
"table": {
"name": "Album",
"schema": "dbo"
},
"source": "mssql",
"cascade": true
}
},
{
"type": "mssql_untrack_table",
"args": {
"table": {
"name": "Artist",
"schema": "dbo"
},
"source": "mssql",
"cascade": true
}
},
{
"type": "mssql_untrack_table",
"args": {
"table": {
"name": "Customer",
"schema": "dbo"
},
"source": "mssql",
"cascade": true
}
},
{
"type": "mssql_untrack_table",
"args": {
"table": {
"name": "Employee",
"schema": "dbo"
},
"source": "mssql",
"cascade": true
}
},
{
"type": "mssql_untrack_table",
"args": {
"table": {
"name": "Genre",
"schema": "dbo"
},
"source": "mssql",
"cascade": true
}
},
{
"type": "mssql_untrack_table",
"args": {
"table": {
"name": "Invoice",
"schema": "dbo"
},
"source": "mssql",
"cascade": true
}
},
{
"type": "mssql_untrack_table",
"args": {
"table": {
"name": "InvoiceLine",
"schema": "dbo"
},
"source": "mssql",
"cascade": true
}
},
{
"type": "mssql_untrack_table",
"args": {
"table": {
"name": "MSreplication_options",
"schema": "dbo"
},
"source": "mssql",
"cascade": true
}
},
{
"type": "mssql_untrack_table",
"args": {
"table": {
"name": "MediaType",
"schema": "dbo"
},
"source": "mssql",
"cascade": true
}
},
{
"type": "mssql_untrack_table",
"args": {
"table": {
"name": "Playlist",
"schema": "dbo"
},
"source": "mssql",
"cascade": true
}
},
{
"type": "mssql_untrack_table",
"args": {
"table": {
"name": "PlaylistTrack",
"schema": "dbo"
},
"source": "mssql",
"cascade": true
}
},
{
"type": "mssql_untrack_table",
"args": {
"table": {
"name": "Track",
"schema": "dbo"
},
"source": "mssql",
"cascade": true
}
},
{
"type": "mssql_untrack_table",
"args": {
"table": {
"name": "spt_fallback_db",
"schema": "dbo"
},
"source": "mssql",
"cascade": true
}
},
{
"type": "mssql_untrack_table",
"args": {
"table": {
"name": "spt_fallback_dev",
"schema": "dbo"
},
"source": "mssql",
"cascade": true
}
},
{
"type": "mssql_untrack_table",
"args": {
"table": {
"name": "spt_fallback_usg",
"schema": "dbo"
},
"source": "mssql",
"cascade": true
}
},
{
"type": "mssql_untrack_table",
"args": {
"table": {
"name": "spt_monitor",
"schema": "dbo"
},
"source": "mssql",
"cascade": true
}
},
{
"type": "mssql_untrack_table",
"args": {
"table": {
"name": "spt_values",
"schema": "dbo"
},
"source": "mssql",
"cascade": true
}
}
]
}
7 changes: 6 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ seed_chinook_database: ## Creates Chinook database schema & seed data in Hasura
seed_chinook_database_mssql: ## Creates Chinook database schema & seed data in Hasura for testing
./containers/mssql-seed-chinook.sh

teardown_chinook_database_mssql: ## Untracks tables before deleting them, needed due to https://github.com/hasura/graphql-engine-mono/issues/1435
./containers/mssql-teardown-chinook.sh

setup_events_table: ## Sets up events table for subscriptions
./containers/psql-setup-events-table.sh

Expand Down Expand Up @@ -69,7 +72,9 @@ install_k6: ## Handles installing k6 either Mac or Debian-based Linux (for local
setup_all: ## Sets up containers and then creates Chinook database
setup_containers setup_events_table
setup_mssql: setup_containers setup_events_table seed_chinook_database_mssql build_local_docker_image
benchmark_mssql: run_update_rows_mssql run_docker_subscription_bench_mssql
run_benchmark_mssql: run_docker_subscription_bench_mssql run_update_rows_mssql
teardown_mssql: teardown_chinook_database_mssql cleanup
benchmark_mssql: setup_mssql run_benchmark_mssql teardown_mssql

help:
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
Expand Down

0 comments on commit 2d11e11

Please sign in to comment.