Skip to content

Commit

Permalink
add yarn/dbtool command insert-local-datastore (#7944)
Browse files Browse the repository at this point in the history
* add yarn/dbtool command insert-local-datastore

* typo

* fix typo
  • Loading branch information
fm3 authored Jul 24, 2024
1 parent b588729 commit 3ec2977
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
"refresh-schema": "./tools/postgres/dbtool.js refresh-schema && rm -f target/scala-2.13/src_managed/schema/com/scalableminds/webknossos/schema/Tables.scala",
"enable-jobs": "sed -i -e 's/jobsEnabled = false/jobsEnabled = true/g' ./conf/application.conf; sed -i -e 's/voxelyticsEnabled = false/voxelyticsEnabled = true/g' ./conf/application.conf; ./tools/postgres/dbtool.js enable-jobs",
"disable-jobs": "sed -i -e 's/jobsEnabled = true/jobsEnabled = false/g' ./conf/application.conf; sed -i -e 's/voxelyticsEnabled = true/voxelyticsEnabled = false/g' ./conf/application.conf; ./tools/postgres/dbtool.js disable-jobs",
"insert-local-datastore": "./tools/postgres/dbtool.js insert-local-datastore",
"coverage-local": "c8 report --reporter=html && echo Success! Open coverage/index.html",
"coverage": "c8 report --reporter=text-lcov | coveralls",
"postcheckout": "echo 'Deleting auto-generated typescript files...' && rm -f frontend/javascripts/test/snapshots/type-check/*.ts",
Expand Down
13 changes: 13 additions & 0 deletions tools/postgres/dbtool.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,19 @@ program
console.log("✨✨ Done");
});

program
.command("insert-local-datastore")
.description("Inserts local datastore (note that this is redundant to initialData on webknossos startup)")
.action(() => {
console.log("Inserting local datastore in the local database");
console.log(
callPsql(
`INSERT INTO webknossos.dataStores(name, url, publicUrl, key) VALUES('localhost', 'http://localhost:9000', 'http://localhost:9000', 'something-secure') ON CONFLICT DO NOTHING`,
),
);
console.log("✨✨ Done");
});

program
.command("enable-jobs")
.description("Activates jobs in WEBKNOSSOS by registering a worker")
Expand Down

0 comments on commit 3ec2977

Please sign in to comment.