Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

relation nulling fix #2

Open
wants to merge 1 commit into
base: moonbeam-new
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions db/migrations/1662233768902-Data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = class Data1662233768902 {
name = 'Data1662233768902'

async up(db) {
await db.query(`ALTER TABLE "token" DROP CONSTRAINT "FK_5c85dbbd108d915a13f71de39ad"`)
await db.query(`ALTER TABLE "token" ALTER COLUMN "contract_id" SET NOT NULL`)
await db.query(`ALTER TABLE "token" ADD CONSTRAINT "FK_5c85dbbd108d915a13f71de39ad" FOREIGN KEY ("contract_id") REFERENCES "contract"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`)
}

async down(db) {
await db.query(`ALTER TABLE "token" ADD CONSTRAINT "FK_5c85dbbd108d915a13f71de39ad" FOREIGN KEY ("contract_id") REFERENCES "contract"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`)
await db.query(`ALTER TABLE "token" ALTER COLUMN "contract_id" DROP NOT NULL`)
await db.query(`ALTER TABLE "token" DROP CONSTRAINT "FK_5c85dbbd108d915a13f71de39ad"`)
}
}
214 changes: 81 additions & 133 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"devDependencies": {
"@subsquid/substrate-metadata-explorer": "1.0.6",
"@subsquid/substrate-typegen": "1.2.2",
"@subsquid/typeorm-codegen": "0.1.0",
"@subsquid/typeorm-codegen": "0.1.1",
"@types/node": "^17.0.23",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"eslint": "^7.32.0",
Expand Down
3 changes: 3 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type Metadata @entity {
type Token @entity {
id: ID!
numericId: BigInt! @index
ownerId: ID
owner: Owner
# tokenURI of contract
tokenUri: String
Expand All @@ -35,7 +36,9 @@ type Token @entity {
updatedAt: BigInt! @index
createdAt: BigInt! @index
transfers: [Transfer!]! @derivedFrom(field: "token")
contractId: ID!
contract: Contract!
metadataId: ID
metadata: Metadata
}

Expand Down
Loading