-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #252 from daiagi/tokenEntity-cop-out
avoid deletion
- Loading branch information
Showing
6 changed files
with
47 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = class Data1711017751137 { | ||
name = 'Data1711017751137' | ||
|
||
async up(db) { | ||
await db.query(`ALTER TABLE "token_entity" ADD "deleted" boolean NOT NULL`) | ||
} | ||
|
||
async down(db) { | ||
await db.query(`ALTER TABLE "token_entity" DROP COLUMN "deleted"`) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
export const totalTokenEntities = ` | ||
SELECT COUNT(DISTINCT token_id) as total_count | ||
FROM nft_entity | ||
SELECT COUNT(DISTINCT ne.token_id) as total_count | ||
FROM nft_entity as ne | ||
JOIN token_entity ON ne.token_id = token_entity.id AND | ||
token_entity.deleted = false | ||
WHERE | ||
($1::text IS NULL OR current_owner = $1) AND | ||
($6::text IS NULL OR issuer = $6) AND | ||
($5::text[] IS NULL OR issuer NOT IN (SELECT unnest($5))) AND | ||
($2::bigint IS NULL OR price >= $2::bigint) AND | ||
($3::bigint IS NULL OR price > $3::bigint) AND | ||
($4::bigint IS NULL OR price <= $4::bigint) AND | ||
($7::text[] IS NULL OR nft_entity.collection_id = ANY($7)) AND | ||
($8::text IS NULL OR LOWER(nft_entity.name) LIKE LOWER('%' || $8 || '%')); | ||
` | ||
($1::text IS NULL OR ne.current_owner = $1) AND | ||
($6::text IS NULL OR ne.issuer = $6) AND | ||
($5::text[] IS NULL OR ne.issuer NOT IN (SELECT unnest($5))) AND | ||
($2::bigint IS NULL OR ne.price >= $2::bigint) AND | ||
($3::bigint IS NULL OR ne.price > $3::bigint) AND | ||
($4::bigint IS NULL OR ne.price <= $4::bigint) AND | ||
($7::text[] IS NULL OR ne.collection_id = ANY($7)) AND | ||
($8::text IS NULL OR LOWER(ne.name) LIKE LOWER('%' || $8 || '%')); | ||
`; |