@@ -15,13 +15,13 @@ CREATE INDEX IF NOT EXISTS block_header_time ON block_header (realtime);
1515
1616CREATE TABLE IF NOT EXISTS txn (
1717round bigint NOT NULL ,
18- intra smallint NOT NULL ,
18+ intra integer NOT NULL ,
1919typeenum smallint NOT NULL ,
2020asset bigint NOT NULL , -- 0=Algos, otherwise AssetIndex
2121txid bytea , -- base32 of [32]byte hash, or NULL for inner transactions.
2222txnbytes bytea , -- msgpack encoding of signed txn with apply data, or NULL for inner transactions.
2323txn jsonb NOT NULL , -- json encoding of signed txn with apply data
24- extra jsonb,
24+ extra jsonb NOT NULL ,
2525PRIMARY KEY ( round, intra )
2626);
2727
@@ -34,7 +34,7 @@ CREATE INDEX IF NOT EXISTS txn_by_tixid ON txn ( txid );
3434CREATE TABLE IF NOT EXISTS txn_participation (
3535addr bytea NOT NULL ,
3636round bigint NOT NULL ,
37- intra smallint NOT NULL
37+ intra integer NOT NULL
3838);
3939
4040-- For query account transactions
@@ -47,10 +47,10 @@ CREATE TABLE IF NOT EXISTS account (
4747 rewardsbase bigint NOT NULL ,
4848 rewards_total bigint NOT NULL ,
4949 deleted bool NOT NULL , -- whether or not it is currently deleted
50- created_at bigint NOT NULL DEFAULT 0 , -- round that the account is first used
50+ created_at bigint NOT NULL , -- round that the account is first used
5151 closed_at bigint , -- round that the account was last closed
52- keytype varchar (8 ), -- sig,msig,lsig
53- account_data jsonb -- trimmed AccountData that excludes the fields above and the four creatable maps
52+ keytype varchar (8 ), -- sig, msig, lsig, or null if unknown
53+ account_data jsonb NOT NULL -- trimmed AccountData that excludes the fields above and the four creatable maps
5454);
5555
5656-- data.basics.AccountData Assets[asset id] AssetHolding{}
@@ -60,7 +60,7 @@ CREATE TABLE IF NOT EXISTS account_asset (
6060 amount numeric (20 ) NOT NULL , -- need the full 18446744073709551615
6161 frozen boolean NOT NULL ,
6262 deleted bool NOT NULL , -- whether or not it is currently deleted
63- created_at bigint NOT NULL DEFAULT 0 , -- round that the asset was added to an account
63+ created_at bigint NOT NULL , -- round that the asset was added to an account
6464 closed_at bigint , -- round that the asset was last removed from the account
6565 PRIMARY KEY (addr, assetid)
6666);
@@ -77,7 +77,7 @@ CREATE TABLE IF NOT EXISTS asset (
7777 creator_addr bytea NOT NULL ,
7878 params jsonb NOT NULL , -- data.basics.AssetParams -- TODO index some fields?
7979 deleted bool NOT NULL , -- whether or not it is currently deleted
80- created_at bigint NOT NULL DEFAULT 0 , -- round that the asset was created
80+ created_at bigint NOT NULL , -- round that the asset was created
8181 closed_at bigint -- round that the asset was closed; cannot be recreated because the index is unique
8282);
8383
@@ -95,10 +95,10 @@ CREATE TABLE IF NOT EXISTS metastate (
9595-- roughly go-algorand/data/basics/userBalance.go AppParams
9696CREATE TABLE IF NOT EXISTS app (
9797 index bigint PRIMARY KEY ,
98- creator bytea , -- account address
99- params jsonb,
98+ creator bytea NOT NULL , -- account address
99+ params jsonb NOT NULL ,
100100 deleted bool NOT NULL , -- whether or not it is currently deleted
101- created_at bigint NOT NULL DEFAULT 0 , -- round that the asset was created
101+ created_at bigint NOT NULL , -- round that the asset was created
102102 closed_at bigint -- round that the app was deleted; cannot be recreated because the index is unique
103103);
104104
@@ -109,9 +109,9 @@ CREATE INDEX IF NOT EXISTS app_by_creator ON app ( creator );
109109CREATE TABLE IF NOT EXISTS account_app (
110110 addr bytea ,
111111 app bigint ,
112- localstate jsonb,
112+ localstate jsonb NOT NULL ,
113113 deleted bool NOT NULL , -- whether or not it is currently deleted
114- created_at bigint NOT NULL DEFAULT 0 , -- round that the app was added to an account
114+ created_at bigint NOT NULL , -- round that the app was added to an account
115115 closed_at bigint , -- round that the account_app was last removed from the account
116116 PRIMARY KEY (addr, app)
117117);
0 commit comments