cosmos-sdk/indexer/postgres/tests/testdata/init_schema.txt
Aaron Craelius 9376db5508
feat(indexer): postgres schema creation + CI config (#20701)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: marbar3778 <marbar3778@yahoo.com>
2024-07-18 09:34:09 +00:00

57 lines
1.6 KiB
Plaintext

Creating enum type
CREATE TYPE "test_my_enum" AS ENUM ('a', 'b', 'c');
Creating enum type
CREATE TYPE "test_vote_type" AS ENUM ('yes', 'no', 'abstain');
Creating table test_all_kinds
CREATE TABLE IF NOT EXISTS "test_all_kinds" (
"id" BIGINT NOT NULL,
"ts" TIMESTAMPTZ GENERATED ALWAYS AS (nanos_to_timestamptz("ts_nanos")) STORED,
"ts_nanos" BIGINT NOT NULL,
"string" TEXT NOT NULL,
"bytes" BYTEA NOT NULL,
"int8" SMALLINT NOT NULL,
"uint8" SMALLINT NOT NULL,
"int16" SMALLINT NOT NULL,
"uint16" INTEGER NOT NULL,
"int32" INTEGER NOT NULL,
"uint32" BIGINT NOT NULL,
"int64" BIGINT NOT NULL,
"uint64" NUMERIC NOT NULL,
"integer" NUMERIC NOT NULL,
"decimal" NUMERIC NOT NULL,
"bool" BOOLEAN NOT NULL,
"time" TIMESTAMPTZ GENERATED ALWAYS AS (nanos_to_timestamptz("time_nanos")) STORED,
"time_nanos" BIGINT NOT NULL,
"duration" BIGINT NOT NULL,
"float32" REAL NOT NULL,
"float64" DOUBLE PRECISION NOT NULL,
"bech32address" TEXT NOT NULL,
"enum" "test_my_enum" NOT NULL,
"json" JSONB NOT NULL,
PRIMARY KEY ("id", "ts_nanos")
);
GRANT SELECT ON TABLE "test_all_kinds" TO PUBLIC;
Creating table test_singleton
CREATE TABLE IF NOT EXISTS "test_singleton" (
_id INTEGER NOT NULL CHECK (_id = 1),
"foo" TEXT NOT NULL,
"bar" INTEGER NULL,
"an_enum" "test_my_enum" NOT NULL,
PRIMARY KEY (_id)
);
GRANT SELECT ON TABLE "test_singleton" TO PUBLIC;
Creating table test_vote
CREATE TABLE IF NOT EXISTS "test_vote" (
"proposal" BIGINT NOT NULL,
"address" TEXT NOT NULL,
"vote" "test_vote_type" NOT NULL,
_deleted BOOLEAN NOT NULL DEFAULT FALSE,
PRIMARY KEY ("proposal", "address")
);
GRANT SELECT ON TABLE "test_vote" TO PUBLIC;