-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathsql.sql
More file actions
executable file
·25 lines (18 loc) · 789 Bytes
/
sql.sql
File metadata and controls
executable file
·25 lines (18 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
select * from contracts
delete from contracts
drop table contracts
CREATE TABLE contracts(
contract VARCHAR(64) PRIMARY KEY UNIQUE NOT NULL,
signer VARCHAR(56) UNIQUE NOT NULL,
pendingTxns VARCHAR(75)[] DEFAULT NULL
)
ALTER TABLE contracts
ADD COLUMN pendingTxns VARCHAR(75)[] DEFAULT NULL
INSERT INTO contracts (contract, signer)
select 'GCNANNNLGDICM5NJOT7QD7MLW34M4WLJPTNOAXWEAR4CE4LO23FZ5WDR', 'SDRJWX2SNJTMFFGGGO4DQXL7X5SHVENZLYX6K7LCZQSIJ6XSEMTCXLHY'
update contracts set
pendingtxns = NULL
WHERE contract = 'GCNANNNLGDICM5NJOT7QD7MLW34M4WLJPTNOAXWEAR4CE4LO23FZ5WDR'
update contracts set
pendingtxns = (select array_agg(distinct e) from unnest(pendingtxns || '{${transaction.hash().toString('hex')}}') e)
where not pendingtxns @> '{${transaction.hash().toString('hex')}}'