-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(backend): create materialized views for staking pools (#614)
- Loading branch information
1 parent
70c7201
commit a172c21
Showing
4 changed files
with
33 additions
and
3 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
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,7 @@ | ||
import { upSQL } from 'knex-migrate-sql-file'; | ||
|
||
export async function up(knex) { | ||
await upSQL(knex); | ||
} | ||
|
||
export function down() {} |
17 changes: 17 additions & 0 deletions
17
apps/backend/migrations/20241108151848_staking_pools.up.sql
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,17 @@ | ||
CREATE MATERIALIZED VIEW staking_pools AS | ||
SELECT | ||
account_id | ||
FROM | ||
accounts | ||
WHERE | ||
account_id LIKE ANY ( | ||
ARRAY[ | ||
'%.poolv1.near', | ||
'%.pool.near', | ||
'%.pool.%.m0', | ||
'%.factory01.littlefarm.testnet', | ||
'%.factory.colorpalette.testnet' | ||
] | ||
); | ||
|
||
CREATE UNIQUE INDEX ON staking_pools (account_id); |
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