Skip to content

Commit 25058e5

Browse files
Cleanup in the DB schema. (#718)
1 parent 18004b0 commit 25058e5

File tree

7 files changed

+295
-293
lines changed

7 files changed

+295
-293
lines changed

api/generated/common/routes.go

Lines changed: 146 additions & 146 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/generated/common/types.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/generated/v2/routes.go

Lines changed: 132 additions & 132 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/generated/v2/types.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/indexer.oas2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@
751751
"type": "string"
752752
},
753753
"sig-type": {
754-
"description": "Indicates what type of signature is used by this account, must be one of:\n* sig\n* msig\n* lsig",
754+
"description": "Indicates what type of signature is used by this account, must be one of:\n* sig\n* msig\n* lsig\n* or null if unknown",
755755
"type": "string",
756756
"enum": [
757757
"sig",

api/indexer.oas3.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@
614614
"type": "integer"
615615
},
616616
"sig-type": {
617-
"description": "Indicates what type of signature is used by this account, must be one of:\n* sig\n* msig\n* lsig",
617+
"description": "Indicates what type of signature is used by this account, must be one of:\n* sig\n* msig\n* lsig\n* or null if unknown",
618618
"enum": [
619619
"sig",
620620
"msig",

idb/postgres/internal/schema/setup_postgres.sql

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ CREATE INDEX IF NOT EXISTS block_header_time ON block_header (realtime);
1515

1616
CREATE TABLE IF NOT EXISTS txn (
1717
round bigint NOT NULL,
18-
intra smallint NOT NULL,
18+
intra integer NOT NULL,
1919
typeenum smallint NOT NULL,
2020
asset bigint NOT NULL, -- 0=Algos, otherwise AssetIndex
2121
txid bytea, -- base32 of [32]byte hash, or NULL for inner transactions.
2222
txnbytes bytea, -- msgpack encoding of signed txn with apply data, or NULL for inner transactions.
2323
txn jsonb NOT NULL, -- json encoding of signed txn with apply data
24-
extra jsonb,
24+
extra jsonb NOT NULL,
2525
PRIMARY KEY ( round, intra )
2626
);
2727

@@ -34,7 +34,7 @@ CREATE INDEX IF NOT EXISTS txn_by_tixid ON txn ( txid );
3434
CREATE TABLE IF NOT EXISTS txn_participation (
3535
addr bytea NOT NULL,
3636
round 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
9696
CREATE 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 );
109109
CREATE 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

Comments
 (0)