Skip to content

Commit

Permalink
Fix bad commit and race conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisnurse committed Sep 4, 2021
1 parent f42d7b9 commit ec91547
Show file tree
Hide file tree
Showing 5 changed files with 172 additions and 331 deletions.
22 changes: 0 additions & 22 deletions cli.js

This file was deleted.

58 changes: 21 additions & 37 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,52 @@
version: "3.6"

services:

qiktrak_db:
env_file: .env
env_file: .env

container_name: qiktrak_db
image: postgres
container_name: qiktrak_db
image: postgres

volumes:
- ./initdb:/docker-entrypoint-initdb.d/
volumes:
- ./initdb:/docker-entrypoint-initdb.d/

ports:
- "7001:5432"
ports:
- '7000:5432'

restart: always
restart: always

qiktrak_gql:
env_file: .env

image: hasura/graphql-engine:latest
container_name: qiktrak_gql
env_file: .env
image: hasura/graphql-engine:latest
container_name: qiktrak_gql

links:
- qiktrak_db
links:
- qiktrak_db

ports:
- "7002:8080"
ports:
- '7001:8080'

command:
- graphql-engine
- serve
command:
- graphql-engine
- serve

restart: always
restart: always

<<<<<<< HEAD
qik-trak:
env_file: .env
environment:
- IN_CONTAINER=true
=======
# Use this if you want to build the app into a container that you can run from the docker
# qik-trak:
# env_file: .env
>>>>>>> 5be04e37e07a4ff127d8bf97465e748a8c061761

# container_name: qik-trak

<<<<<<< HEAD
build:
context: .
dockerfile: ./Dockerfile

links:
- qiktrak_db
- qiktrak_gql
=======
# build:
# context: .
# dockerfile: ./Dockerfile

# links:
# - qiktrak_db
# - qiktrak_gql
>>>>>>> 5be04e37e07a4ff127d8bf97465e748a8c061761

# command:
# - node
Expand Down
46 changes: 44 additions & 2 deletions qik-trak-hasura.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,46 @@ class QikTrakHasura {
this.Namer = new QikTrakNames(config);
}

async UntrackTable(table_name) {

var query = {
type: "pg_untrack_table",
args: {
table: {
schema: this.config.targetSchema,
name: table_name
},
source: this.config.targetDatabase,
cascade: true
}
};

await this.runGraphQL_Query('/v1/metadata', query)
.catch(e => {
if (e.response.data.error.includes("already untracked")) {
return;
}

this.Config.Logger.Log("");
this.Config.Logger.Log("");
this.Config.Logger.Log("--------------------------------------------------------------");
this.Config.Logger.Log("");
this.Config.Logger.Log("QIK-TRAK: ERROR");
this.Config.Logger.Log("");
this.Config.Logger.Log("GRAPHQL QUERY FAILED TO EXECUTE");
this.Config.Logger.Log("");
this.Config.Logger.Log("Error Message : " + e.response.data.internal.error.message);
this.Config.Logger.Log(e.response.request.data);
this.Config.Logger.Log("");
this.Config.Logger.Log("Query:");
this.Config.Logger.Log("");
this.Config.Logger.Log(JSON.stringify(query));
this.Config.Logger.Log("");
this.Config.Logger.Log("Are Hasura and the database fully initialised?");
this.Config.Logger.Log("");
this.Config.Logger.Log("--------------------------------------------------------------");
});;
}

async createRelationships(relationship) {
const array_rel_spec = {
Expand Down Expand Up @@ -186,11 +226,13 @@ class QikTrakHasura {
const root = JSON.parse(content);

root.views.map(async (view) => {
await this.buildView(view);
await this.buildJsonView(view);
});
}

async buildView(view) {
//--------------------------------------------------------------------------------------------------------------------------
// Build a specific JSON view
async buildJsonView(view) {

const view_header =
`
Expand Down
Loading

0 comments on commit ec91547

Please sign in to comment.