Skip to content

Commit

Permalink
Merge pull request #11 from zeeshanakram3/add-graphql-query-to-get-pa…
Browse files Browse the repository at this point in the history
…ckage-version

Add graphql query to get package version
  • Loading branch information
zeeshanakram3 authored Jan 15, 2024
2 parents 7ca5a1c + abf1be7 commit bf083d3
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ lib
# Autogenerated stuff
src/types
src/model/generated
db/migrations/*.js
db/migrations/*-Data.js
schema.graphql
/db/export
/db/export
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.4.0

- Created `SquidVersion` graphql entity schema and exposed query to fetch the current version of the storage squid package.

# 1.3.0

- Disables processing of Hot/Un-finalized blocks by the processor.
Expand Down
13 changes: 0 additions & 13 deletions db/migrations/1702466370902-Operator.js

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions db/migrations/2100000000000-Indexes.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
module.exports = class Indexes2000000000000 {
name = 'Indexes2000000000000'
module.exports = class Indexes2100000000000 {
name = 'Indexes2100000000000'

async up(db) {
await db.query(`CREATE INDEX "events_type" ON "event" USING BTREE (("data"->>'isTypeOf'));`)
await db.query(`CREATE INDEX "events_dataObjectId" ON "event" USING BTREE (("data"->>'dataObjectId'));`)
await db.query(
`CREATE INDEX "events_dataObjectId" ON "event" USING BTREE (("data"->>'dataObjectId'));`
)
}

async down(db) {
Expand Down
29 changes: 29 additions & 0 deletions db/migrations/2200000000000-Operator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const fs = require('fs')
const path = require('path')

module.exports = class Operator2200000000000 {
name = 'Operator2200000000000'

async up(db) {
// Path to your package.json file
const packageJsonPath = path.join(__dirname, '../../package.json')

// Read the package.json file synchronously
const data = fs.readFileSync(packageJsonPath, 'utf8')

// Parse the JSON data
const packageJson = JSON.parse(data)

await db.query(
`INSERT INTO "squid_version" ("id", "version")
VALUES ('${packageJson.name}' ,'${packageJson.version}');`
)

// Create pg_stat_statements extension for analyzing query stats
await db.query(`CREATE EXTENSION pg_stat_statements;`)
}

async down(db) {
await db.query(`DROP EXTENSION pg_stat_statements;`)
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "storage-squid",
"version": "1.3.0",
"version": "1.4.0",
"engines": {
"node": ">=16"
},
Expand Down
4 changes: 4 additions & 0 deletions schema/misc.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
type SquidVersion @entity {
"Current version of the storage squid package"
version: String!
}

0 comments on commit bf083d3

Please sign in to comment.