From 290925dc10a5486e4c8aa4f2e61dfc0a960097e2 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Mon, 18 Dec 2023 14:18:16 +0700 Subject: [PATCH] fix(event-db): lint checks now pass --- .sqlfluff | 83 +--- Earthfile | 2 +- catalyst-gateway/event-db/Earthfile | 15 +- .../event-db/migrations/V1__config_tables.sql | 50 +-- .../event-db/migrations/V2__event_tables.sql | 76 ++-- .../migrations/V3__objective_tables.sql | 60 +-- .../migrations/V4__proposal_tables.sql | 136 +++--- .../event-db/migrations/V5__vote_plan.sql | 44 +- .../event-db/migrations/V6__registration.sql | 136 +++--- .../event-db/migrations/V7__vote_tables.sql | 22 +- .../migrations/V8__catalyst_automation.sql | 46 +- .../migrations/V9__moderation_stage.sql | 28 +- .../stage_data/dev/00001_testfund_event.sql | 100 ++--- .../dev/00002_testfund_ideascale_params.sql | 16 +- .../stage_data/testnet/00001_fund10_event.sql | 100 ++--- .../testnet/00002_fund10_ideascale_params.sql | 16 +- .../seed/test_data/01_event_table.sql | 178 ++++---- .../seed/test_data/04_contribution_table.sql | 402 +++++++++--------- .../seed/test_data/06_objective_table.sql | 62 +-- .../seed/test_data/08_proposal_table.sql | 238 +++++------ .../test_data/09_proposal_review_table.sql | 24 +- .../seed/test_data/10_review_rating_table.sql | 40 +- .../11_objective_review_metric_table.sql | 40 +- 23 files changed, 920 insertions(+), 994 deletions(-) diff --git a/.sqlfluff b/.sqlfluff index b6a2eec1239..3a43ddca946 100644 --- a/.sqlfluff +++ b/.sqlfluff @@ -1,87 +1,24 @@ -[sqlfluff] - -# cspell: words templater cpus ctes capitalisation organisation +# cspell: words capitalisation -# Supported dialects https://docs.sqlfluff.com/en/stable/dialects.html -# Or run 'sqlfluff dialects' -# We do not set a global SQL Dialect, so that we can support multiple -# dialects in the same way. The dialect must be specified in a .sqlfluff file with the SQL files. +[sqlfluff] dialect = postgres - -# One of [raw|jinja|python|placeholder] -templater = raw - -# Comma separated list of rules to exclude, or None -# See https://docs.sqlfluff.com/en/stable/configuration.html#enabling-and-disabling-rules -# AM04 (ambiguous.column_count) and ST06 (structure.column_order) are -# two of the more controversial rules included to illustrate usage. -# exclude_rules = ambiguous.column_count, structure.column_order - -# The standard max_line_length is 80 in line with the convention of -# other tools and several style guides. Many projects however prefer -# something a little longer. -# Set to zero or negative to disable checks. +large_file_skip_char_limit = 0 max_line_length = 120 -# CPU processes to use while linting. -# The default is "single threaded" to allow easy debugging, but this -# is often undesirable at scale. -# If positive, just implies number of processes. -# If negative or zero, implies number_of_cpus - specified_number. -# e.g. -1 means use all processors but one. 0 means all cpus. -processes = 0 - -# If using the dbt templater, we recommend setting the project dir. -[sqlfluff:templater:dbt] -project_dir = ./ - [sqlfluff:indentation] -# While implicit indents are not enabled by default. Many of the -# SQLFluff maintainers do use them in their projects. -#allow_implicit_indents = True +tab_space_size = 2 -indent_unit = space -tab_space_size = 4 -indented_joins = True -indented_ctes = True -indented_using_on = True -indented_on_contents = True -indented_then = True -indented_then_contents = True -# allow_implicit_indents = False -template_blocks_indent = True - -# The default configuration for aliasing rules is "consistent" -# which will auto-detect the setting from the rest of the file. This -# is less desirable in a new project and you may find this (slightly -# more strict) setting more useful. -[sqlfluff:rules:aliasing.table] -aliasing = explicit -[sqlfluff:rules:aliasing.column] -aliasing = explicit -[sqlfluff:rules:aliasing.length] -min_alias_length = 3 +[sqlfluff:rules:layout.long_lines] +ignore_comment_lines = True +ignore_comment_clauses = True -# The default configuration for capitalisation rules is "consistent" -# which will auto-detect the setting from the rest of the file. This -# is less desirable in a new project and you may find this (slightly -# more strict) setting more useful. -# Typically we find users rely on syntax highlighting rather than -# capitalisation to distinguish between keywords and identifiers. -# Clearly, if your organisation has already settled on uppercase -# formatting for any of these syntax elements then set them to "upper". -# See https://stackoverflow.com/questions/608196/why-should-i-capitalize-my-sql-keywords-is-there-a-good-reason [sqlfluff:rules:capitalisation.keywords] capitalisation_policy = upper [sqlfluff:rules:capitalisation.identifiers] -capitalisation_policy = lower extended_capitalisation_policy = lower [sqlfluff:rules:capitalisation.functions] -extended_capitalisation_policy = lower +extended_capitalisation_policy = upper [sqlfluff:rules:capitalisation.literals] -capitalisation_policy = lower -[sqlfluff:rules:capitalisation.types] extended_capitalisation_policy = upper -[sqlfluff:rules:layout.long_lines] -ignore_comment_clauses = false -ignore_comment_lines = false +[sqlfluff:rules:capitalisation.types] +extended_capitalisation_policy = upper \ No newline at end of file diff --git a/Earthfile b/Earthfile index ccc973a3f8a..f104e57e7aa 100644 --- a/Earthfile +++ b/Earthfile @@ -32,7 +32,7 @@ repo-docs: SAVE ARTIFACT /repo repo -repo-config: +repo-config-2: # Create artifacts of config file we need to refer to in builders. FROM scratch diff --git a/catalyst-gateway/event-db/Earthfile b/catalyst-gateway/event-db/Earthfile index 7a1b48afaf1..663059199a4 100644 --- a/catalyst-gateway/event-db/Earthfile +++ b/catalyst-gateway/event-db/Earthfile @@ -12,6 +12,8 @@ builder: DO github.com/input-output-hk/catalyst-ci/earthly/postgresql:fix/postgres-builders+BUILDER \ --sqlfluff_cfg=./../../+repo-config/repo/.sqlfluff + COPY ./../../+repo-config-2/repo/.sqlfluff . + # check if the sqlfiles are properly formatted and pass lint quality checks. # CI target : true check: @@ -19,25 +21,12 @@ check: DO github.com/input-output-hk/catalyst-ci/earthly/postgresql:fix/postgres-builders+CHECK -# Internal: build-sqlfluff is a target to build the necessary `sqlfluff` tool container. -# CI target : false -# This allows us to run sqlfluff commands locally without needing to install it locally. -# It does not need to be run directly, it is used by the `format` target. -build-sqlfluff: - BUILD github.com/input-output-hk/catalyst-ci/earthly/postgresql:fix/postgres-builders+sqlfluff-image # format all SQL files in the current project. Local developers tool. # CI target : false format: LOCALLY - # This is a trick. Earthly can NOT build and run a container in the same invocation. - # Because this target is running LOCALLY, and we know earthly must be installed, we can - # call earthly locally to build and publish the local target we need to run the sqlfluff linter. - # By recursively running earthly, we sidestep the limitation which prevents us from building - # a container and running it in the same invocation. - RUN earthly +build-sqlfluff - DO github.com/input-output-hk/catalyst-ci/earthly/postgresql:fix/postgres-builders+FORMAT --src=$(echo ${PWD}/../../) # build an event db docker image. diff --git a/catalyst-gateway/event-db/migrations/V1__config_tables.sql b/catalyst-gateway/event-db/migrations/V1__config_tables.sql index e3bed682940..8d1842dad75 100644 --- a/catalyst-gateway/event-db/migrations/V1__config_tables.sql +++ b/catalyst-gateway/event-db/migrations/V1__config_tables.sql @@ -7,10 +7,10 @@ -- Version of the schema (Used by Refinery to manage migrations.). CREATE TABLE IF NOT EXISTS refinery_schema_history ( - version INTEGER NOT NULL PRIMARY KEY, - name VARCHAR(255), - applied_on VARCHAR(255), - checksum VARCHAR(255) + version INTEGER NOT NULL PRIMARY KEY, + name VARCHAR(255), + applied_on VARCHAR(255), + checksum VARCHAR(255) ); COMMENT ON TABLE refinery_schema_history IS @@ -36,15 +36,15 @@ Managed by the `refinery` cli tool.'; -- * Dashes, symbols or upper case should not be used. -- Catalyst Event Database CREATE TABLE json_schema_type ( - id UUID PRIMARY KEY, - type TEXT NOT NULL, - name TEXT NOT NULL, - schema JSONB NOT NULL + id UUID PRIMARY KEY, + type TEXT NOT NULL, + name TEXT NOT NULL, + schema JSONB NOT NULL ); CREATE INDEX json_schema_type_idx ON json_schema_type ("type"); CREATE UNIQUE INDEX json_schema_type_name_idx ON json_schema_type ( - "type", "name" + "type", "name" ); COMMENT ON TABLE json_schema_type IS @@ -71,14 +71,14 @@ Must match the `name` component of the $id URI inside the schema.'; -- Config Table -- This table is looked up with three keys, `id`, `id2` and `id3` CREATE TABLE config ( - row_id SERIAL PRIMARY KEY, - id VARCHAR NOT NULL, - id2 VARCHAR NOT NULL, - id3 VARCHAR NOT NULL, - value JSONB NULL, - value_schema UUID, - - FOREIGN KEY (value_schema) REFERENCES json_schema_type (id) ON DELETE CASCADE + row_id SERIAL PRIMARY KEY, + id VARCHAR NOT NULL, + id2 VARCHAR NOT NULL, + id3 VARCHAR NOT NULL, + value JSONB NULL, + value_schema UUID, + + FOREIGN KEY (value_schema) REFERENCES json_schema_type (id) ON DELETE CASCADE ); -- id+id2+id3 must be unique, they are a combined key. @@ -123,12 +123,12 @@ at the app level to allow for querying groups of data.'; INSERT INTO json_schema_type (id, type, name, schema) VALUES ( - 'd899cd44-3513-487b-ab46-fdca662a724d', -- Fix the Schema ID so that it is consistent. - 'config', - 'dbsync', - (SELECT jsonb FROM pg_read_file('../json_schemas/config/dbsync.json')), - '62d614c0-97a7-41ec-a976-91294b8f4384', -- Fix the Schema ID so that it is consistent. - 'config', - 'registration', - (SELECT jsonb FROM pg_read_file('../json_schemas/config/registration.json')) + 'd899cd44-3513-487b-ab46-fdca662a724d', -- Fix the Schema ID so that it is consistent. + 'config', + 'dbsync', + (SELECT jsonb FROM PG_READ_FILE('../json_schemas/config/dbsync.json')), + '62d614c0-97a7-41ec-a976-91294b8f4384', -- Fix the Schema ID so that it is consistent. + 'config', + 'registration', + (SELECT jsonb FROM PG_READ_FILE('../json_schemas/config/registration.json')) ); diff --git a/catalyst-gateway/event-db/migrations/V2__event_tables.sql b/catalyst-gateway/event-db/migrations/V2__event_tables.sql index 9f589a0ed3e..d79d03bab22 100644 --- a/catalyst-gateway/event-db/migrations/V2__event_tables.sql +++ b/catalyst-gateway/event-db/migrations/V2__event_tables.sql @@ -20,15 +20,15 @@ -- ------------------------------------------------------------------------------------------------- CREATE TABLE event_type ( - id UUID PRIMARY KEY DEFAULT gen_random_uuid(), - name TEXT NOT NULL, - description_schema UUID NOT NULL, - data_schema UUID NOT NULL, - - FOREIGN KEY (description_schema) REFERENCES json_schema_type ( - id - ) ON DELETE CASCADE, - FOREIGN KEY (data_schema) REFERENCES json_schema_type (id) ON DELETE CASCADE + id UUID PRIMARY KEY DEFAULT GEN_RANDOM_UUID(), + name TEXT NOT NULL, + description_schema UUID NOT NULL, + data_schema UUID NOT NULL, + + FOREIGN KEY (description_schema) REFERENCES json_schema_type ( + id + ) ON DELETE CASCADE, + FOREIGN KEY (data_schema) REFERENCES json_schema_type (id) ON DELETE CASCADE ); CREATE UNIQUE INDEX event_type_name_idx ON event_type (name); @@ -59,22 +59,22 @@ VALUES INSERT INTO json_schema_type (id, type, name, schema) VALUES ( - 'd899cd44-3513-487b-ab46-fdca662a724d', -- From the schema file. - 'event_description', - 'multiline_text', - ( - SELECT jsonb - FROM pg_read_file('../json_schemas/event/description/multiline_text.json') - ) + 'd899cd44-3513-487b-ab46-fdca662a724d', -- From the schema file. + 'event_description', + 'multiline_text', + ( + SELECT jsonb + FROM PG_READ_FILE('../json_schemas/event/description/multiline_text.json') + ) ), ( - '9c5df318-fa9a-4310-80fa-490f46d1cc43', -- From the schema file. - 'event_data', - 'catalyst_v1', - ( - SELECT jsonb - FROM pg_read_file('../json_schemas/event/description/catalyst_v1.json') - ) + '9c5df318-fa9a-4310-80fa-490f46d1cc43', -- From the schema file. + 'event_data', + 'catalyst_v1', + ( + SELECT jsonb + FROM PG_READ_FILE('../json_schemas/event/description/catalyst_v1.json') + ) ); -- Define a Catalyst V1 Event. @@ -82,27 +82,27 @@ VALUES INSERT INTO event_type (name, description_schema, data_schema) VALUES ( - 'Catalyst V1', - 'd899cd44-3513-487b-ab46-fdca662a724d', - '9c5df318-fa9a-4310-80fa-490f46d1cc43' + 'Catalyst V1', + 'd899cd44-3513-487b-ab46-fdca662a724d', + '9c5df318-fa9a-4310-80fa-490f46d1cc43' ); -- ------------------------------------------------------------------------------------------------- -- Event Table - Defines each voting or decision event CREATE TABLE "event" ( - id UUID PRIMARY KEY DEFAULT gen_random_uuid(), - -- The Organizer/Administrator of this event. - -- Update once RBAC is defined, as Organizer is an RBAC Role. - organizer TEXT NOT NULL, - type UUID REFERENCES event_type (id), - name TEXT NOT NULL, - description JSONB NOT NULL, - start_time TIMESTAMP, - backing_start TIMESTAMP, - backing_end TIMESTAMP, - end_time TIMESTAMP, - data JSONB NOT NULL + id UUID PRIMARY KEY DEFAULT GEN_RANDOM_UUID(), + -- The Organizer/Administrator of this event. + -- Update once RBAC is defined, as Organizer is an RBAC Role. + organizer TEXT NOT NULL, + type UUID REFERENCES event_type (id), + name TEXT NOT NULL, + description JSONB NOT NULL, + start_time TIMESTAMP, + backing_start TIMESTAMP, + backing_end TIMESTAMP, + end_time TIMESTAMP, + data JSONB NOT NULL ); CREATE UNIQUE INDEX event_name_idx ON event (name); diff --git a/catalyst-gateway/event-db/migrations/V3__objective_tables.sql b/catalyst-gateway/event-db/migrations/V3__objective_tables.sql index c31f0d78553..128ab3116bb 100644 --- a/catalyst-gateway/event-db/migrations/V3__objective_tables.sql +++ b/catalyst-gateway/event-db/migrations/V3__objective_tables.sql @@ -3,8 +3,8 @@ -- objective types table - Defines all currently known objectives types. CREATE TABLE objective_category ( - name TEXT PRIMARY KEY, - description TEXT + name TEXT PRIMARY KEY, + description TEXT ); COMMENT ON TABLE objective_category IS 'Defines all known and valid objective categories.'; @@ -22,8 +22,8 @@ VALUES -- known currencies - Defines all currently known currencies. CREATE TABLE currency ( - name TEXT PRIMARY KEY, - description TEXT + name TEXT PRIMARY KEY, + description TEXT ); COMMENT ON TABLE currency IS 'Defines all known and valid currencies.'; @@ -35,8 +35,8 @@ COMMENT ON COLUMN currency.description IS 'A Description of this kind of currenc INSERT INTO currency (name, description) VALUES ( - 'USD_ADA', - 'US Dollars, converted to Cardano ADA at time of reward calculation.' + 'USD_ADA', + 'US Dollars, converted to Cardano ADA at time of reward calculation.' ), ('ADA', 'Cardano ADA.'), ('CLAP', 'CLAP tokens.'), @@ -45,10 +45,10 @@ VALUES -- known vote options - Defines all currently known vote options. CREATE TABLE vote_options ( - id SERIAL PRIMARY KEY, + id SERIAL PRIMARY KEY, - idea_scale TEXT ARRAY UNIQUE, - objective TEXT ARRAY UNIQUE + idea_scale TEXT ARRAY UNIQUE, + objective TEXT ARRAY UNIQUE ); COMMENT ON TABLE vote_options IS 'Defines all known vote plan option types.'; @@ -67,13 +67,13 @@ VALUES CREATE TABLE goal ( - id SERIAL PRIMARY KEY, - event_id INTEGER NOT NULL, + id SERIAL PRIMARY KEY, + event_id INTEGER NOT NULL, - idx INTEGER NOT NULL, - name VARCHAR NOT NULL, + idx INTEGER NOT NULL, + name VARCHAR NOT NULL, - FOREIGN KEY (event_id) REFERENCES event (row_id) ON DELETE CASCADE + FOREIGN KEY (event_id) REFERENCES event (row_id) ON DELETE CASCADE ); CREATE UNIQUE INDEX goal_index ON goal (event_id, idx); @@ -91,27 +91,27 @@ COMMENT ON INDEX goal_index IS 'An index to enforce uniqueness of the relative ` CREATE TABLE objective ( - row_id SERIAL PRIMARY KEY, + row_id SERIAL PRIMARY KEY, - id INTEGER NOT NULL, - event INTEGER NOT NULL, + id INTEGER NOT NULL, + event INTEGER NOT NULL, - category TEXT NOT NULL, - title TEXT NOT NULL, - description TEXT NOT NULL, + category TEXT NOT NULL, + title TEXT NOT NULL, + description TEXT NOT NULL, - rewards_currency TEXT, - rewards_total BIGINT, - rewards_total_lovelace BIGINT, - proposers_rewards BIGINT, - vote_options INTEGER, + rewards_currency TEXT, + rewards_total BIGINT, + rewards_total_lovelace BIGINT, + proposers_rewards BIGINT, + vote_options INTEGER, - extra JSONB, + extra JSONB, - FOREIGN KEY (event) REFERENCES event (row_id) ON DELETE CASCADE, - FOREIGN KEY (category) REFERENCES objective_category (name) ON DELETE CASCADE, - FOREIGN KEY (rewards_currency) REFERENCES currency (name) ON DELETE CASCADE, - FOREIGN KEY (vote_options) REFERENCES vote_options (id) ON DELETE CASCADE + FOREIGN KEY (event) REFERENCES event (row_id) ON DELETE CASCADE, + FOREIGN KEY (category) REFERENCES objective_category (name) ON DELETE CASCADE, + FOREIGN KEY (rewards_currency) REFERENCES currency (name) ON DELETE CASCADE, + FOREIGN KEY (vote_options) REFERENCES vote_options (id) ON DELETE CASCADE ); CREATE UNIQUE INDEX objective_idx ON objective (id, event); diff --git a/catalyst-gateway/event-db/migrations/V4__proposal_tables.sql b/catalyst-gateway/event-db/migrations/V4__proposal_tables.sql index 1ade5945af3..a9674f7c737 100644 --- a/catalyst-gateway/event-db/migrations/V4__proposal_tables.sql +++ b/catalyst-gateway/event-db/migrations/V4__proposal_tables.sql @@ -4,29 +4,29 @@ CREATE TABLE proposal ( - row_id SERIAL PRIMARY KEY, - id INTEGER NOT NULL, - objective INTEGER NOT NULL, - title TEXT NOT NULL, - summary TEXT NOT NULL, - public_key TEXT NOT NULL, - funds BIGINT NOT NULL, - url TEXT NOT NULL, - files_url TEXT NOT NULL, - impact_score BIGINT NOT NULL, - - extra JSONB, - - proposer_name TEXT NOT NULL, - proposer_contact TEXT NOT NULL, - proposer_url TEXT NOT NULL, - proposer_relevant_experience TEXT NOT NULL, - bb_proposal_id BYTEA, - - FOREIGN KEY (objective) REFERENCES objective (row_id) ON DELETE CASCADE, - FOREIGN KEY (bb_vote_options) REFERENCES vote_options ( - objective - ) ON DELETE CASCADE + row_id SERIAL PRIMARY KEY, + id INTEGER NOT NULL, + objective INTEGER NOT NULL, + title TEXT NOT NULL, + summary TEXT NOT NULL, + public_key TEXT NOT NULL, + funds BIGINT NOT NULL, + url TEXT NOT NULL, + files_url TEXT NOT NULL, + impact_score BIGINT NOT NULL, + + extra JSONB, + + proposer_name TEXT NOT NULL, + proposer_contact TEXT NOT NULL, + proposer_url TEXT NOT NULL, + proposer_relevant_experience TEXT NOT NULL, + bb_proposal_id BYTEA, + + FOREIGN KEY (objective) REFERENCES objective (row_id) ON DELETE CASCADE, + FOREIGN KEY (bb_vote_options) REFERENCES vote_options ( + objective + ) ON DELETE CASCADE ); CREATE UNIQUE INDEX proposal_index ON proposal (id, objective); @@ -69,15 +69,15 @@ COMMENT ON COLUMN proposal.extra IS -- Reviewer's levels table CREATE TABLE reviewer_level ( - row_id SERIAL PRIMARY KEY, - name TEXT NOT NULL, - total_reward_pct NUMERIC(6, 3) CONSTRAINT percentage CHECK ( - total_reward_pct <= 100 AND total_reward_pct >= 0 - ), + row_id SERIAL PRIMARY KEY, + name TEXT NOT NULL, + total_reward_pct NUMERIC(6, 3) CONSTRAINT percentage CHECK ( + total_reward_pct <= 100 AND total_reward_pct >= 0 + ), - event_id INTEGER NOT NULL, + event_id INTEGER NOT NULL, - FOREIGN KEY (event_id) REFERENCES event (row_id) ON DELETE CASCADE + FOREIGN KEY (event_id) REFERENCES event (row_id) ON DELETE CASCADE ); COMMENT ON TABLE reviewer_level IS @@ -96,18 +96,18 @@ COMMENT ON COLUMN reviewer_level.event_id IS 'The specific Event ID this review -- suit adaptability without needing schema changes. CREATE TABLE proposal_review ( - row_id SERIAL PRIMARY KEY, - proposal_id INTEGER NOT NULL, - assessor VARCHAR NOT NULL, - assessor_level INTEGER, - reward_address TEXT, - - flags JSONB NULL, - - FOREIGN KEY (proposal_id) REFERENCES proposal (row_id) ON DELETE CASCADE, - FOREIGN KEY (assessor_level) REFERENCES reviewer_level ( - row_id - ) ON DELETE CASCADE + row_id SERIAL PRIMARY KEY, + proposal_id INTEGER NOT NULL, + assessor VARCHAR NOT NULL, + assessor_level INTEGER, + reward_address TEXT, + + flags JSONB NULL, + + FOREIGN KEY (proposal_id) REFERENCES proposal (row_id) ON DELETE CASCADE, + FOREIGN KEY (assessor_level) REFERENCES reviewer_level ( + row_id + ) ON DELETE CASCADE ); COMMENT ON TABLE proposal_review IS 'All Reviews.'; @@ -131,12 +131,12 @@ Each entry = '; CREATE TABLE review_metric ( - row_id SERIAL PRIMARY KEY, - name VARCHAR NOT NULL, - description VARCHAR NULL, - min INTEGER NOT NULL, - max INTEGER NOT NULL, - map JSONB ARRAY NULL + row_id SERIAL PRIMARY KEY, + name VARCHAR NOT NULL, + description VARCHAR NULL, + min INTEGER NOT NULL, + max INTEGER NOT NULL, + map JSONB ARRAY NULL ); COMMENT ON TABLE review_metric IS 'Definition of all possible review metrics.'; COMMENT ON COLUMN review_metric.row_id IS 'The synthetic ID of this metric.'; @@ -165,23 +165,23 @@ VALUES ('auditability', 'Auditability Rating', 0, 5, null), ('value', 'Value Proposition Rating', 0, 5, null), ('vpa_ranking', 'VPA Ranking of the review', 0, 3, ARRAY[ - '{"name":"Excellent","desc":"Excellent Review"}', - '{"name":"Good","desc":"Could be improved."}', - '{"name":"FilteredOut","desc":"Exclude this review"}', - '{"name":"NA", "desc":"Not Applicable"}' + '{"name":"Excellent","desc":"Excellent Review"}', + '{"name":"Good","desc":"Could be improved."}', + '{"name":"FilteredOut","desc":"Exclude this review"}', + '{"name":"NA", "desc":"Not Applicable"}' ]::JSON []); CREATE TABLE objective_review_metric ( - row_id SERIAL PRIMARY KEY, - objective INTEGER NOT NULL, - metric INTEGER NOT NULL, - note BOOLEAN, - review_group VARCHAR, + row_id SERIAL PRIMARY KEY, + objective INTEGER NOT NULL, + metric INTEGER NOT NULL, + note BOOLEAN, + review_group VARCHAR, - UNIQUE (objective, metric, review_group), + UNIQUE (objective, metric, review_group), - FOREIGN KEY (objective) REFERENCES objective (row_id) ON DELETE CASCADE, - FOREIGN KEY (metric) REFERENCES review_metric (row_id) ON DELETE CASCADE + FOREIGN KEY (objective) REFERENCES objective (row_id) ON DELETE CASCADE, + FOREIGN KEY (metric) REFERENCES review_metric (row_id) ON DELETE CASCADE ); @@ -198,16 +198,16 @@ COMMENT ON COLUMN objective_review_metric.review_group IS 'The review group that CREATE TABLE review_rating ( - row_id SERIAL PRIMARY KEY, - review_id INTEGER NOT NULL, - metric INTEGER NOT NULL, - rating INTEGER NOT NULL, - note VARCHAR, + row_id SERIAL PRIMARY KEY, + review_id INTEGER NOT NULL, + metric INTEGER NOT NULL, + rating INTEGER NOT NULL, + note VARCHAR, - UNIQUE (review_id, metric), + UNIQUE (review_id, metric), - FOREIGN KEY (review_id) REFERENCES proposal_review (row_id) ON DELETE CASCADE, - FOREIGN KEY (metric) REFERENCES review_metric (row_id) ON DELETE CASCADE + FOREIGN KEY (review_id) REFERENCES proposal_review (row_id) ON DELETE CASCADE, + FOREIGN KEY (metric) REFERENCES review_metric (row_id) ON DELETE CASCADE ); diff --git a/catalyst-gateway/event-db/migrations/V5__vote_plan.sql b/catalyst-gateway/event-db/migrations/V5__vote_plan.sql index 680507afbbd..9502f73f30d 100644 --- a/catalyst-gateway/event-db/migrations/V5__vote_plan.sql +++ b/catalyst-gateway/event-db/migrations/V5__vote_plan.sql @@ -4,8 +4,8 @@ CREATE TABLE voteplan_category ( - name TEXT PRIMARY KEY, - public_key BOOL + name TEXT PRIMARY KEY, + public_key BOOL ); @@ -23,7 +23,7 @@ COMMENT ON COLUMN voteplan_category.public_key IS 'Does this vote plan category -- groups CREATE TABLE voting_group ( - name TEXT PRIMARY KEY + name TEXT PRIMARY KEY ); INSERT INTO voting_group (name) @@ -38,18 +38,18 @@ COMMENT ON COLUMN voting_group.name IS 'The ID of this voting group.'; CREATE TABLE voteplan ( - row_id SERIAL PRIMARY KEY, - objective_id INTEGER NOT NULL, - - id VARCHAR NOT NULL, - category TEXT NOT NULL, - encryption_key VARCHAR, - group_id TEXT, - token_id TEXT, - - FOREIGN KEY (objective_id) REFERENCES objective (row_id) ON DELETE CASCADE, - FOREIGN KEY (category) REFERENCES voteplan_category (name) ON DELETE CASCADE, - FOREIGN KEY (group_id) REFERENCES voting_group (name) ON DELETE CASCADE + row_id SERIAL PRIMARY KEY, + objective_id INTEGER NOT NULL, + + id VARCHAR NOT NULL, + category TEXT NOT NULL, + encryption_key VARCHAR, + group_id TEXT, + token_id TEXT, + + FOREIGN KEY (objective_id) REFERENCES objective (row_id) ON DELETE CASCADE, + FOREIGN KEY (category) REFERENCES voteplan_category (name) ON DELETE CASCADE, + FOREIGN KEY (group_id) REFERENCES voting_group (name) ON DELETE CASCADE ); COMMENT ON TABLE voteplan IS 'All Vote plans.'; @@ -71,17 +71,17 @@ COMMENT ON COLUMN voteplan.group_id IS 'The identifier of voting power token use -- and each voteplan can contain multiple proposals. CREATE TABLE proposal_voteplan ( - row_id SERIAL PRIMARY KEY, - proposal_id INTEGER, - voteplan_id INTEGER, - bb_proposal_index BIGINT, + row_id SERIAL PRIMARY KEY, + proposal_id INTEGER, + voteplan_id INTEGER, + bb_proposal_index BIGINT, - FOREIGN KEY (proposal_id) REFERENCES proposal (row_id) ON DELETE CASCADE, - FOREIGN KEY (voteplan_id) REFERENCES voteplan (row_id) ON DELETE CASCADE + FOREIGN KEY (proposal_id) REFERENCES proposal (row_id) ON DELETE CASCADE, + FOREIGN KEY (voteplan_id) REFERENCES voteplan (row_id) ON DELETE CASCADE ); CREATE UNIQUE INDEX proposal_voteplan_idx ON proposal_voteplan ( - proposal_id, voteplan_id, bb_proposal_index + proposal_id, voteplan_id, bb_proposal_index ); COMMENT ON TABLE proposal_voteplan IS 'Table to link Proposals to Vote plans in a Many to Many relationship.'; diff --git a/catalyst-gateway/event-db/migrations/V6__registration.sql b/catalyst-gateway/event-db/migrations/V6__registration.sql index 1e3f1da8a33..1af5a4e4c22 100644 --- a/catalyst-gateway/event-db/migrations/V6__registration.sql +++ b/catalyst-gateway/event-db/migrations/V6__registration.sql @@ -11,18 +11,18 @@ -- Used internally to track the updates to the database. CREATE TABLE cardano_update_state ( - id BIGSERIAL PRIMARY KEY, - time TIMESTAMP NOT NULL, - end_time TIMESTAMP NOT NULL, - updater_id TEXT NOT NULL, + id BIGSERIAL PRIMARY KEY, + time TIMESTAMP NOT NULL, + end_time TIMESTAMP NOT NULL, + updater_id TEXT NOT NULL, - network TEXT NOT NULL, + network TEXT NOT NULL, - old_max_slot_no BIGINT NOT NULL, - new_max_slot_no BIGINT NOT NULL, - rollback_slot_no BIGINT NOT NULL, + old_max_slot_no BIGINT NOT NULL, + new_max_slot_no BIGINT NOT NULL, + rollback_slot_no BIGINT NOT NULL, - stats JSONB NOT NULL + stats JSONB NOT NULL ); CREATE INDEX cardano_update_state_idx ON cardano_update_state (id, network); @@ -32,7 +32,7 @@ COMMENT ON INDEX cardano_update_state_time_idx IS This index can be used to find the latest state record for a particular network.'; CREATE INDEX cardano_update_state_time_idx ON cardano_update_state ( - time, network + time, network ); COMMENT ON INDEX cardano_update_state_time_idx IS @@ -82,13 +82,13 @@ Must conform to Schema: `catalyst_schema://0f917b13-afac-40d2-8263-b17ca8219914/ -- Slot Index Table CREATE TABLE slot_index ( - slot_no BIGINT NOT NULL, - network TEXT NOT NULL, - epoch_no BIGINT NOT NULL, - time TIMESTAMP NOT NULL, - block_hash BYTEA NOT NULL, + slot_no BIGINT NOT NULL, + network TEXT NOT NULL, + epoch_no BIGINT NOT NULL, + time TIMESTAMP NOT NULL, + block_hash BYTEA NOT NULL, - PRIMARY KEY (slot_no, network) + PRIMARY KEY (slot_no, network) ); CREATE INDEX slot_index_time_idx ON slot_index (time, network); @@ -127,22 +127,22 @@ COMMENT ON COLUMN slot_index.block_hash IS -- INNER JOIN stake_address ON stake_address.id = tx_out.stake_address_id; -- network needs to be supplied, as dbsync only has a single database per network. CREATE TABLE cardano_utxo ( - tx_id BIGINT NOT NULL, - index INTEGER NOT NULL, - network TEXT NOT NULL, + tx_id BIGINT NOT NULL, + index INTEGER NOT NULL, + network TEXT NOT NULL, - value BIGINT NOT NULL, + value BIGINT NOT NULL, - slot_no BIGINT NOT NULL, + slot_no BIGINT NOT NULL, - stake_credential BYTEA NOT NULL, + stake_credential BYTEA NOT NULL, - PRIMARY KEY (tx_id, index, network), - FOREIGN KEY (slot_no, network) REFERENCES slot_index (slot_no, network) + PRIMARY KEY (tx_id, index, network), + FOREIGN KEY (slot_no, network) REFERENCES slot_index (slot_no, network) ); CREATE INDEX cardano_utxo_stake_credential_idx ON utxo ( - stake_credential, slot_no + stake_credential, slot_no ); COMMENT ON INDEX cardano_utxo_stake_credential_idx IS 'Index to allow us to efficiently lookup a set of UTXOs by stake credential relative to a slot_no.'; @@ -175,16 +175,16 @@ COMMENT ON COLUMN cardano_utxo.stake_credential IS -- INNER JOIN block ON tx.block_id = block.id; -- network needs to be supplied, as dbsync only has a single database per network. CREATE TABLE cardano_stxo ( - tx_id BIGINT NOT NULL, - index INTEGER NOT NULL, - network TEXT NOT NULL, + tx_id BIGINT NOT NULL, + index INTEGER NOT NULL, + network TEXT NOT NULL, - spent_tx_id BIGINT NOT NULL, - spent_slot_no BIGINT NOT NULL, + spent_tx_id BIGINT NOT NULL, + spent_slot_no BIGINT NOT NULL, - PRIMARY KEY (tx_id, index, network), - FOREIGN KEY (tx_id, index, network) REFERENCES utxo (tx_id, index, network), - FOREIGN KEY (spent_slot_no, network) REFERENCES slot_index (slot_no, network) + PRIMARY KEY (tx_id, index, network), + FOREIGN KEY (tx_id, index, network) REFERENCES utxo (tx_id, index, network), + FOREIGN KEY (spent_slot_no, network) REFERENCES slot_index (slot_no, network) ); CREATE INDEX cardano_stxo_slot_idx ON stxo (spent_slot_no, network); @@ -220,20 +220,20 @@ This lets us determine when the TX Output was spent, so we can calculate staked -- `slot_no` needs to be calculated from the current earned_epoch_no as the first slot in the next epoch. -- 'network' needs to be supplied, as dbsync only has a single database per network. CREATE TABLE cardano_reward ( - slot_no BIGINT NOT NULL, -- First slot of the epoch following the epoch the rewards were earned for. - network TEXT NOT NULL, - stake_credential BYTEA NOT NULL, + slot_no BIGINT NOT NULL, -- First slot of the epoch following the epoch the rewards were earned for. + network TEXT NOT NULL, + stake_credential BYTEA NOT NULL, - earned_epoch_no BIGINT NOT NULL, + earned_epoch_no BIGINT NOT NULL, - value BIGINT NOT NULL, + value BIGINT NOT NULL, - PRIMARY KEY (slot_no, network, stake_credential), - FOREIGN KEY (slot_no, network) REFERENCES slot_index (slot_no, network) + PRIMARY KEY (slot_no, network, stake_credential), + FOREIGN KEY (slot_no, network) REFERENCES slot_index (slot_no, network) ); CREATE INDEX cardano_rewards_stake_credential_idx ON cardano_rewards ( - stake_credential, slot_no + stake_credential, slot_no ); COMMENT ON INDEX cardano_rewards_stake_credential_idx IS @@ -266,13 +266,13 @@ COMMENT ON COLUMN cardano_reward.value IS -- INNER JOIN stake_address ON stake_address.id = withdrawal.addr_id; -- 'network' needs to be supplied, as dbsync only has a single database per network. CREATE TABLE cardano_withdrawn_reward ( - slot_no BIGINT NOT NULL, - network TEXT NOT NULL, - stake_credential BYTEA NOT NULL, - value BIGINT NOT NULL, + slot_no BIGINT NOT NULL, + network TEXT NOT NULL, + stake_credential BYTEA NOT NULL, + value BIGINT NOT NULL, - PRIMARY KEY (slot_no, network), - FOREIGN KEY (slot_no, network) REFERENCES slot_index (slot_no, network) + PRIMARY KEY (slot_no, network), + FOREIGN KEY (slot_no, network) REFERENCES slot_index (slot_no, network) ); COMMENT ON TABLE cardano_withdrawn_reward IS @@ -301,46 +301,46 @@ COMMENT ON COLUMN cardano_withdrawn_reward.value IS -- -- 'network' needs to be supplied, as dbsync only has a single database per network. CREATE TABLE cardano_voter_registration ( - txn_hash BYTEA PRIMARY KEY NOT NULL, + txn_hash BYTEA PRIMARY KEY NOT NULL, - slot_no BIGINT NULL, - tx_id BIGINT NULL, - network TEXT NOT NULL, + slot_no BIGINT NULL, + tx_id BIGINT NULL, + network TEXT NOT NULL, - stake_credential BYTEA NULL, - public_voting_key BYTEA NULL, - payment_address BYTEA NULL, - nonce BIGINT NULL, + stake_credential BYTEA NULL, + public_voting_key BYTEA NULL, + payment_address BYTEA NULL, + nonce BIGINT NULL, - metadata_61284 BYTEA NULL, -- We can purge metadata for valid registrations that are old to save storage space. - metadata_61285 BYTEA NULL, -- We can purge metadata for valid registrations that are old to save storage space. + metadata_61284 BYTEA NULL, -- We can purge metadata for valid registrations that are old to save storage space. + metadata_61285 BYTEA NULL, -- We can purge metadata for valid registrations that are old to save storage space. - valid BOOLEAN NOT NULL DEFAULT false, - stats JSONB NULL, - -- record rolled back in stats if the registration was lost during a rollback, its also invalid at this point. - -- Other stats we can record are is it a CIP-36 or CIP-15 registration format. - -- does it have a valid reward address but not a payment address, so we can't pay to it. - -- other flags about why the registration was invalid. - -- other flags about statistical data (if any). + valid BOOLEAN NOT NULL DEFAULT false, + stats JSONB NULL, + -- record rolled back in stats if the registration was lost during a rollback, its also invalid at this point. + -- Other stats we can record are is it a CIP-36 or CIP-15 registration format. + -- does it have a valid reward address but not a payment address, so we can't pay to it. + -- other flags about why the registration was invalid. + -- other flags about statistical data (if any). - FOREIGN KEY (slot_no, network) REFERENCES slot_index (slot_no, network) + FOREIGN KEY (slot_no, network) REFERENCES slot_index (slot_no, network) ); CREATE INDEX cardano_voter_registration_stake_credential_idx ON cardano_voter_registration ( - stake_credential, nonce, valid + stake_credential, nonce, valid ); COMMENT ON INDEX cardano_voter_registration_stake_credential_idx IS 'Optimize lookups for "stake_credential" or "stake_credential"+"nonce" or "stake_credential"+"nonce"+"valid".'; CREATE INDEX cardano_voter_registration_voting_key_idx ON cardano_voter_registration ( - public_voting_key, nonce, valid + public_voting_key, nonce, valid ); COMMENT ON INDEX cardano_voter_registration_voting_key_idx IS 'Optimize lookups for "public_voting_key" or "public_voting_key"+"nonce" or "public_voting_key"+"nonce"+"valid".'; CREATE INDEX cardano_voter_registration_voting_key_idx ON cardano_voter_registration ( - public_voting_key, nonce, valid + public_voting_key, nonce, valid ); COMMENT ON INDEX cardano_voter_registration_voting_key_idx IS 'Optimize lookups for "public_voting_key" or "public_voting_key"+"nonce" or "public_voting_key"+"nonce"+"valid".'; diff --git a/catalyst-gateway/event-db/migrations/V7__vote_tables.sql b/catalyst-gateway/event-db/migrations/V7__vote_tables.sql index ec2caad1c13..ce92bbe57ac 100644 --- a/catalyst-gateway/event-db/migrations/V7__vote_tables.sql +++ b/catalyst-gateway/event-db/migrations/V7__vote_tables.sql @@ -3,19 +3,19 @@ -- vote storage (replicates on-chain data for easy querying) CREATE TABLE ballot ( - row_id SERIAL8 PRIMARY KEY, - objective INTEGER NOT NULL, - proposal INTEGER NULL, + row_id SERIAL8 PRIMARY KEY, + objective INTEGER NOT NULL, + proposal INTEGER NULL, - voter INTEGER NOT NULL, - fragment_id TEXT NOT NULL, - cast_at TIMESTAMP NOT NULL, - choice SMALLINT NULL, - raw_fragment BYTEA NOT NULL, + voter INTEGER NOT NULL, + fragment_id TEXT NOT NULL, + cast_at TIMESTAMP NOT NULL, + choice SMALLINT NULL, + raw_fragment BYTEA NOT NULL, - FOREIGN KEY (voter) REFERENCES voter (row_id) ON DELETE CASCADE, - FOREIGN KEY (objective) REFERENCES objective (row_id) ON DELETE CASCADE, - FOREIGN KEY (proposal) REFERENCES proposal (row_id) ON DELETE CASCADE + FOREIGN KEY (voter) REFERENCES voter (row_id) ON DELETE CASCADE, + FOREIGN KEY (objective) REFERENCES objective (row_id) ON DELETE CASCADE, + FOREIGN KEY (proposal) REFERENCES proposal (row_id) ON DELETE CASCADE ); CREATE UNIQUE INDEX ballot_proposal_idx ON ballot (proposal, fragment_id); diff --git a/catalyst-gateway/event-db/migrations/V8__catalyst_automation.sql b/catalyst-gateway/event-db/migrations/V8__catalyst_automation.sql index a1a416081ce..2e26ccc4db7 100644 --- a/catalyst-gateway/event-db/migrations/V8__catalyst_automation.sql +++ b/catalyst-gateway/event-db/migrations/V8__catalyst_automation.sql @@ -3,15 +3,15 @@ -- Voting Nodes Table - Defines nodes in the network -- This table is looked up by hostname and event CREATE TABLE voting_node ( - hostname TEXT NOT NULL, - event INTEGER NOT NULL, + hostname TEXT NOT NULL, + event INTEGER NOT NULL, - pubkey TEXT NOT NULL, - seckey TEXT NOT NULL, - netkey TEXT NOT NULL, + pubkey TEXT NOT NULL, + seckey TEXT NOT NULL, + netkey TEXT NOT NULL, - PRIMARY KEY (hostname, event), - FOREIGN KEY (event) REFERENCES event (row_id) ON DELETE CASCADE + PRIMARY KEY (hostname, event), + FOREIGN KEY (event) REFERENCES event (row_id) ON DELETE CASCADE ); COMMENT ON TABLE voting_node IS @@ -28,16 +28,16 @@ COMMENT ON COLUMN voting_node.netkey IS 'Encrypted Ed25519 secret key for the no -- Tally Committee Table - Stores data about the tally committee per voting event -- This table is looked up by event CREATE TABLE tally_committee ( - row_id SERIAL PRIMARY KEY, + row_id SERIAL PRIMARY KEY, - event INTEGER NOT NULL UNIQUE, + event INTEGER NOT NULL UNIQUE, - committee_pk TEXT NOT NULL, - committee_id TEXT NOT NULL, - member_crs TEXT, - election_key TEXT, + committee_pk TEXT NOT NULL, + committee_id TEXT NOT NULL, + member_crs TEXT, + election_key TEXT, - FOREIGN KEY (event) REFERENCES event (row_id) ON DELETE CASCADE + FOREIGN KEY (event) REFERENCES event (row_id) ON DELETE CASCADE ); COMMENT ON TABLE tally_committee IS 'Table for storing data about the tally committee per voting event.'; @@ -56,18 +56,18 @@ NULL if the event.committee_size is 0.'; -- Committee Member Table - Stores data about the tally committee members -- This table is looked up by committee CREATE TABLE committee_member ( - row_id SERIAL PRIMARY KEY, + row_id SERIAL PRIMARY KEY, - committee INTEGER NOT NULL, + committee INTEGER NOT NULL, - member_index INTEGER NOT NULL, - threshold INTEGER NOT NULL, - comm_pk TEXT NOT NULL, - comm_sk TEXT NOT NULL, - member_pk TEXT NOT NULL, - member_sk TEXT NOT NULL, + member_index INTEGER NOT NULL, + threshold INTEGER NOT NULL, + comm_pk TEXT NOT NULL, + comm_sk TEXT NOT NULL, + member_pk TEXT NOT NULL, + member_sk TEXT NOT NULL, - FOREIGN KEY (committee) REFERENCES tally_committee (row_id) + FOREIGN KEY (committee) REFERENCES tally_committee (row_id) ); COMMENT ON TABLE committee_member IS 'Table for storing data about the tally committee members.'; diff --git a/catalyst-gateway/event-db/migrations/V9__moderation_stage.sql b/catalyst-gateway/event-db/migrations/V9__moderation_stage.sql index 7c2972e5f42..770c9e0a5b6 100644 --- a/catalyst-gateway/event-db/migrations/V9__moderation_stage.sql +++ b/catalyst-gateway/event-db/migrations/V9__moderation_stage.sql @@ -4,12 +4,12 @@ -- to describe the allocation of moderations that needs to be done. CREATE TABLE moderation_allocation ( - row_id SERIAL PRIMARY KEY, - review_id INTEGER NOT NULL, - user_id INTEGER NOT NULL, + row_id SERIAL PRIMARY KEY, + review_id INTEGER NOT NULL, + user_id INTEGER NOT NULL, - FOREIGN KEY (review_id) REFERENCES proposal_review (row_id) ON DELETE CASCADE, - FOREIGN KEY (user_id) REFERENCES config (row_id) ON DELETE CASCADE + FOREIGN KEY (review_id) REFERENCES proposal_review (row_id) ON DELETE CASCADE, + FOREIGN KEY (user_id) REFERENCES config (row_id) ON DELETE CASCADE ); @@ -22,15 +22,15 @@ COMMENT ON COLUMN moderation_allocation.user_id IS 'The user the relationship is -- Moderation - Defines the moderation submitted by users for each proposal_review. CREATE TABLE moderation ( - row_id SERIAL PRIMARY KEY, - review_id INTEGER NOT NULL, - user_id INTEGER NOT NULL, - classification INTEGER NOT NULL, - rationale VARCHAR, - UNIQUE (review_id, user_id), - - FOREIGN KEY (review_id) REFERENCES proposal_review (row_id) ON DELETE CASCADE, - FOREIGN KEY (user_id) REFERENCES config (row_id) ON DELETE CASCADE + row_id SERIAL PRIMARY KEY, + review_id INTEGER NOT NULL, + user_id INTEGER NOT NULL, + classification INTEGER NOT NULL, + rationale VARCHAR, + UNIQUE (review_id, user_id), + + FOREIGN KEY (review_id) REFERENCES proposal_review (row_id) ON DELETE CASCADE, + FOREIGN KEY (user_id) REFERENCES config (row_id) ON DELETE CASCADE ); diff --git a/catalyst-gateway/event-db/seed/stage_data/dev/00001_testfund_event.sql b/catalyst-gateway/event-db/seed/stage_data/dev/00001_testfund_event.sql index 842fc049825..2aeaeeac9af 100644 --- a/catalyst-gateway/event-db/seed/stage_data/dev/00001_testfund_event.sql +++ b/catalyst-gateway/event-db/seed/stage_data/dev/00001_testfund_event.sql @@ -1,54 +1,54 @@ -- F10 INSERT INTO event ( - row_id, - name, - description, - registration_snapshot_time, - snapshot_start, - voting_power_threshold, - max_voting_power_pct, - review_rewards, - start_time, - end_time, - insight_sharing_start, - proposal_submission_start, - refine_proposals_start, - finalize_proposals_start, - proposal_assessment_start, - assessment_qa_start, - voting_start, - voting_end, - tallying_end, - block0, - block0_hash, - committee_size, - committee_threshold, - extra, - cast_to + row_id, + name, + description, + registration_snapshot_time, + snapshot_start, + voting_power_threshold, + max_voting_power_pct, + review_rewards, + start_time, + end_time, + insight_sharing_start, + proposal_submission_start, + refine_proposals_start, + finalize_proposals_start, + proposal_assessment_start, + assessment_qa_start, + voting_start, + voting_end, + tallying_end, + block0, + block0_hash, + committee_size, + committee_threshold, + extra, + cast_to ) VALUES ( - 0, - 'Test Fund', - 'Catalyst Dev Environment - Test Fund', - '1970-01-01 00:00:00', -- Registration Snapshot Time - '1970-01-01 00:00:00', -- Snapshot Start. - 450000000, -- Voting Power Threshold - 1, -- Max Voting Power PCT - null, -- Review Rewards - '1970-01-01 00:00:00', -- Start Time - '1970-01-01 00:00:00', -- End Time - '1970-01-01 00:00:00', -- Insight Sharing Start - '1970-01-01 00:00:00', -- Proposal Submission Start - '1970-01-01 00:00:00', -- Refine Proposals Start - '1970-01-01 00:00:00', -- Finalize Proposals Start - '1970-01-01 00:00:00', -- Proposal Assessment Start - '1970-01-01 00:00:00', -- Assessment QA Start - '1970-01-01 00:00:00', -- Voting Starts - '1970-01-01 00:00:00', -- Voting Ends - '1970-01-01 00:00:00', -- Tallying Ends - null, -- Block 0 Data - null, -- Block 0 Hash - 1, -- Committee Size - 1, -- Committee Threshold - null, -- Extra - null -- Cast to + 0, + 'Test Fund', + 'Catalyst Dev Environment - Test Fund', + '1970-01-01 00:00:00', -- Registration Snapshot Time + '1970-01-01 00:00:00', -- Snapshot Start. + 450000000, -- Voting Power Threshold + 1, -- Max Voting Power PCT + null, -- Review Rewards + '1970-01-01 00:00:00', -- Start Time + '1970-01-01 00:00:00', -- End Time + '1970-01-01 00:00:00', -- Insight Sharing Start + '1970-01-01 00:00:00', -- Proposal Submission Start + '1970-01-01 00:00:00', -- Refine Proposals Start + '1970-01-01 00:00:00', -- Finalize Proposals Start + '1970-01-01 00:00:00', -- Proposal Assessment Start + '1970-01-01 00:00:00', -- Assessment QA Start + '1970-01-01 00:00:00', -- Voting Starts + '1970-01-01 00:00:00', -- Voting Ends + '1970-01-01 00:00:00', -- Tallying Ends + null, -- Block 0 Data + null, -- Block 0 Hash + 1, -- Committee Size + 1, -- Committee Threshold + null, -- Extra + null -- Cast to ); diff --git a/catalyst-gateway/event-db/seed/stage_data/dev/00002_testfund_ideascale_params.sql b/catalyst-gateway/event-db/seed/stage_data/dev/00002_testfund_ideascale_params.sql index 3794a10e79f..1709e03eaca 100644 --- a/catalyst-gateway/event-db/seed/stage_data/dev/00002_testfund_ideascale_params.sql +++ b/catalyst-gateway/event-db/seed/stage_data/dev/00002_testfund_ideascale_params.sql @@ -1,9 +1,9 @@ -- Define F10 IdeaScale parameters. INSERT INTO config (id, id2, id3, value) VALUES ( - 'ideascale', - '0', - '', - '{ + 'ideascale', + '0', + '', + '{ "group_id": 37429, "review_stage_ids": [171], "nr_allocations": [1, 1], @@ -52,9 +52,9 @@ INSERT INTO config (id, id2, id3, value) VALUES ( -- Use F10 params for event with row_id = 10. INSERT INTO config (id, id2, id3, value) VALUES ( - 'event', - 'ideascale_params', - '0', - '{"params_id": "TestFund"}' + 'event', + 'ideascale_params', + '0', + '{"params_id": "TestFund"}' ) ON CONFLICT (id, id2, id3) DO UPDATE SET value = excluded.value; diff --git a/catalyst-gateway/event-db/seed/stage_data/testnet/00001_fund10_event.sql b/catalyst-gateway/event-db/seed/stage_data/testnet/00001_fund10_event.sql index f011b025fb0..2d227caa82c 100644 --- a/catalyst-gateway/event-db/seed/stage_data/testnet/00001_fund10_event.sql +++ b/catalyst-gateway/event-db/seed/stage_data/testnet/00001_fund10_event.sql @@ -1,54 +1,54 @@ -- F10 INSERT INTO event ( - row_id, - name, - description, - registration_snapshot_time, - snapshot_start, - voting_power_threshold, - max_voting_power_pct, - review_rewards, - start_time, - end_time, - insight_sharing_start, - proposal_submission_start, - refine_proposals_start, - finalize_proposals_start, - proposal_assessment_start, - assessment_qa_start, - voting_start, - voting_end, - tallying_end, - block0, - block0_hash, - committee_size, - committee_threshold, - extra, - cast_to + row_id, + name, + description, + registration_snapshot_time, + snapshot_start, + voting_power_threshold, + max_voting_power_pct, + review_rewards, + start_time, + end_time, + insight_sharing_start, + proposal_submission_start, + refine_proposals_start, + finalize_proposals_start, + proposal_assessment_start, + assessment_qa_start, + voting_start, + voting_end, + tallying_end, + block0, + block0_hash, + committee_size, + committee_threshold, + extra, + cast_to ) VALUES ( - 10, - 'Fund 10', - 'Catalyst Testnet - Fund 10', - '2023-08-18 21:00:00', -- Registration Snapshot Time - '2023-08-23 22:00:00', -- Snapshot Start. - 450000000, -- Voting Power Threshold - 1, -- Max Voting Power PCT - null, -- Review Rewards - '2023-06-16 19:56:00', -- Start Time - '2023-09-18 00:00:00', -- End Time - '2023-06-22 00:00:00', -- Insight Sharing Start - '2023-06-22 00:00:00', -- Proposal Submission Start - '2023-06-22 00:00:00', -- Refine Proposals Start - '2023-07-13 00:00:00', -- Finalize Proposals Start - '2023-07-20 00:00:00', -- Proposal Assessment Start - '2023-08-10 00:00:00', -- Assessment QA Start - '2023-08-31 11:00:00', -- Voting Starts - '2023-09-14 11:00:00', -- Voting Ends - '2023-09-18 11:00:00', -- Tallying Ends - null, -- Block 0 Data - null, -- Block 0 Hash - 1, -- Committee Size - 1, -- Committee Threshold - null, -- Extra - null -- Cast to + 10, + 'Fund 10', + 'Catalyst Testnet - Fund 10', + '2023-08-18 21:00:00', -- Registration Snapshot Time + '2023-08-23 22:00:00', -- Snapshot Start. + 450000000, -- Voting Power Threshold + 1, -- Max Voting Power PCT + null, -- Review Rewards + '2023-06-16 19:56:00', -- Start Time + '2023-09-18 00:00:00', -- End Time + '2023-06-22 00:00:00', -- Insight Sharing Start + '2023-06-22 00:00:00', -- Proposal Submission Start + '2023-06-22 00:00:00', -- Refine Proposals Start + '2023-07-13 00:00:00', -- Finalize Proposals Start + '2023-07-20 00:00:00', -- Proposal Assessment Start + '2023-08-10 00:00:00', -- Assessment QA Start + '2023-08-31 11:00:00', -- Voting Starts + '2023-09-14 11:00:00', -- Voting Ends + '2023-09-18 11:00:00', -- Tallying Ends + null, -- Block 0 Data + null, -- Block 0 Hash + 1, -- Committee Size + 1, -- Committee Threshold + null, -- Extra + null -- Cast to ); diff --git a/catalyst-gateway/event-db/seed/stage_data/testnet/00002_fund10_ideascale_params.sql b/catalyst-gateway/event-db/seed/stage_data/testnet/00002_fund10_ideascale_params.sql index 8497bd0ec10..a55f25f0514 100644 --- a/catalyst-gateway/event-db/seed/stage_data/testnet/00002_fund10_ideascale_params.sql +++ b/catalyst-gateway/event-db/seed/stage_data/testnet/00002_fund10_ideascale_params.sql @@ -1,9 +1,9 @@ -- Define F10 IdeaScale parameters. INSERT INTO config (id, id2, id3, value) VALUES ( - 'ideascale', - '10', - '', - '{ + 'ideascale', + '10', + '', + '{ "group_id": 31051, "review_stage_ids": [143, 145], "nr_allocations": [30, 80], @@ -52,9 +52,9 @@ INSERT INTO config (id, id2, id3, value) VALUES ( -- Use F10 params for event with row_id = 10. INSERT INTO config (id, id2, id3, value) VALUES ( - 'event', - 'ideascale_params', - '10', - '{"params_id": "F10"}' + 'event', + 'ideascale_params', + '10', + '{"params_id": "F10"}' ) ON CONFLICT (id, id2, id3) DO UPDATE SET value = excluded.value; diff --git a/catalyst-gateway/event-db/seed/test_data/01_event_table.sql b/catalyst-gateway/event-db/seed/test_data/01_event_table.sql index 264ffc0bac2..2d47011e51a 100644 --- a/catalyst-gateway/event-db/seed/test_data/01_event_table.sql +++ b/catalyst-gateway/event-db/seed/test_data/01_event_table.sql @@ -1,108 +1,108 @@ INSERT INTO event ( - row_id, name, description, registration_snapshot_time, snapshot_start, - voting_power_threshold, - max_voting_power_pct, - start_time, - end_time, - insight_sharing_start, - proposal_submission_start, - refine_proposals_start, - finalize_proposals_start, - proposal_assessment_start, - assessment_qa_start, - voting_start, - voting_end, - tallying_end, - block0, - block0_hash, - committee_size, - committee_threshold + row_id, name, description, registration_snapshot_time, snapshot_start, + voting_power_threshold, + max_voting_power_pct, + start_time, + end_time, + insight_sharing_start, + proposal_submission_start, + refine_proposals_start, + finalize_proposals_start, + proposal_assessment_start, + assessment_qa_start, + voting_start, + voting_end, + tallying_end, + block0, + block0_hash, + committee_size, + committee_threshold ) VALUES ( - 1, - 'Test Fund 1', 'Test Fund 1 description', - '2020-03-31 12:00:00', '2020-03-31 12:00:00', 1, 100, - '2020-05-01 12:00:00', '2020-06-01 12:00:00', - '2020-03-01 12:00:00', - '2020-03-01 12:00:00', - '2020-03-01 12:00:00', - '2020-03-01 12:00:00', - '2020-03-01 12:00:00', - '2020-03-01 12:00:00', - '2020-05-01 12:00:00', - '2020-06-01 12:00:00', - '2020-07-01 12:00:00', - 'x0000000000000000000000000000000000000000000000000000000000000000', - 'x0000000000000000000000000000000000000000000000000000000000000000', - 4, 4 + 1, + 'Test Fund 1', 'Test Fund 1 description', + '2020-03-31 12:00:00', '2020-03-31 12:00:00', 1, 100, + '2020-05-01 12:00:00', '2020-06-01 12:00:00', + '2020-03-01 12:00:00', + '2020-03-01 12:00:00', + '2020-03-01 12:00:00', + '2020-03-01 12:00:00', + '2020-03-01 12:00:00', + '2020-03-01 12:00:00', + '2020-05-01 12:00:00', + '2020-06-01 12:00:00', + '2020-07-01 12:00:00', + 'x0000000000000000000000000000000000000000000000000000000000000000', + 'x0000000000000000000000000000000000000000000000000000000000000000', + 4, 4 ), ( - 2, - 'Test Fund 2', 'Test Fund 2 description', - '2021-03-31 12:00:00', '2021-03-31 12:00:00', 1, 100, - '2021-05-01 12:00:00', '2021-06-01 12:00:00', - '2021-03-01 12:00:00', - '2021-03-01 12:00:00', - '2021-03-01 12:00:00', - '2021-03-01 12:00:00', - '2021-03-01 12:00:00', - '2021-03-01 12:00:00', - '2021-05-01 12:00:00', - '2021-06-01 12:00:00', - '2021-07-01 12:00:00', - 'x0000000000000000000000000000000000000000000000000000000000000000', - 'x0000000000000000000000000000000000000000000000000000000000000000', - 5, 5 + 2, + 'Test Fund 2', 'Test Fund 2 description', + '2021-03-31 12:00:00', '2021-03-31 12:00:00', 1, 100, + '2021-05-01 12:00:00', '2021-06-01 12:00:00', + '2021-03-01 12:00:00', + '2021-03-01 12:00:00', + '2021-03-01 12:00:00', + '2021-03-01 12:00:00', + '2021-03-01 12:00:00', + '2021-03-01 12:00:00', + '2021-05-01 12:00:00', + '2021-06-01 12:00:00', + '2021-07-01 12:00:00', + 'x0000000000000000000000000000000000000000000000000000000000000000', + 'x0000000000000000000000000000000000000000000000000000000000000000', + 5, 5 ), ( - 3, - 'Test Fund 3', 'Test Fund 3 description', - '2022-03-31 12:00:00', '2022-03-31 12:00:00', 1, 100, - '2022-05-01 12:00:00', '2022-06-01 12:00:00', - '2022-03-01 12:00:00', - '2022-03-01 12:00:00', - '2022-03-01 12:00:00', - '2022-03-01 12:00:00', - '2022-03-01 12:00:00', - '2022-03-01 12:00:00', - '2022-05-01 12:00:00', - '2022-06-01 12:00:00', - '2022-07-01 12:00:00', - 'x0000000000000000000000000000000000000000000000000000000000000000', - 'x0000000000000000000000000000000000000000000000000000000000000000', - 6, 6 + 3, + 'Test Fund 3', 'Test Fund 3 description', + '2022-03-31 12:00:00', '2022-03-31 12:00:00', 1, 100, + '2022-05-01 12:00:00', '2022-06-01 12:00:00', + '2022-03-01 12:00:00', + '2022-03-01 12:00:00', + '2022-03-01 12:00:00', + '2022-03-01 12:00:00', + '2022-03-01 12:00:00', + '2022-03-01 12:00:00', + '2022-05-01 12:00:00', + '2022-06-01 12:00:00', + '2022-07-01 12:00:00', + 'x0000000000000000000000000000000000000000000000000000000000000000', + 'x0000000000000000000000000000000000000000000000000000000000000000', + 6, 6 ), ( - 4, - 'Test Fund 4', 'Test Fund 4 description', - '2022-03-31 12:00:00', '2022-03-31 12:00:00', 1, 100, - '2022-05-01 12:00:00', '2024-06-01 12:00:00', - '2022-03-01 12:00:00', - '2022-03-01 12:00:00', - '2022-03-01 12:00:00', - '2022-03-01 12:00:00', - '2022-03-01 12:00:00', - '2022-03-01 12:00:00', - '2022-05-01 12:00:00', - '2024-06-01 12:00:00', - '2024-07-01 12:00:00', - 'x0000000000000000000000000000000000000000000000000000000000000000', - 'x0000000000000000000000000000000000000000000000000000000000000000', - 6, 6 + 4, + 'Test Fund 4', 'Test Fund 4 description', + '2022-03-31 12:00:00', '2022-03-31 12:00:00', 1, 100, + '2022-05-01 12:00:00', '2024-06-01 12:00:00', + '2022-03-01 12:00:00', + '2022-03-01 12:00:00', + '2022-03-01 12:00:00', + '2022-03-01 12:00:00', + '2022-03-01 12:00:00', + '2022-03-01 12:00:00', + '2022-05-01 12:00:00', + '2024-06-01 12:00:00', + '2024-07-01 12:00:00', + 'x0000000000000000000000000000000000000000000000000000000000000000', + 'x0000000000000000000000000000000000000000000000000000000000000000', + 6, 6 ), ( - 5, - 'Test Fund 5', 'Test Fund 5 description', - null, null, null, null, - null, null, - null, null, null, null, null, null, null, null, null, - null, null, - 6, 6 + 5, + 'Test Fund 5', 'Test Fund 5 description', + null, null, null, null, + null, null, + null, null, null, null, null, null, null, null, null, + null, null, + 6, 6 ); diff --git a/catalyst-gateway/event-db/seed/test_data/04_contribution_table.sql b/catalyst-gateway/event-db/seed/test_data/04_contribution_table.sql index 272820af72a..9fb689a12de 100644 --- a/catalyst-gateway/event-db/seed/test_data/04_contribution_table.sql +++ b/catalyst-gateway/event-db/seed/test_data/04_contribution_table.sql @@ -1,213 +1,213 @@ INSERT INTO contribution ( - row_id, - stake_public_key, - snapshot_id, - voting_key, - voting_weight, - voting_key_idx, - value, - voting_group, - reward_address + row_id, + stake_public_key, + snapshot_id, + voting_key, + voting_weight, + voting_key_idx, + value, + voting_group, + reward_address ) VALUES ( - 1, - 'stake_public_key_1', - 1, - 'voting_key_1', - 1, - 1, - 140, - 'rep', - 'addrr_reward_address_1' -), -( - 2, - 'stake_public_key_2', - 1, - 'voting_key_1', - 1, - 1, - 110, - 'rep', - 'reward_address_2' -), -( - 3, - 'stake_public_key_1', - 1, - 'voting_key_2', - 1, - 1, - 100, - 'rep', - 'reward_address_1' -), -( - 4, - 'stake_public_key_3', - 1, - 'voting_key_2', - 1, - 1, - 50, - 'rep', - 'reward_address_3' -), -( - 5, - 'stake_public_key_4', - 1, - 'voting_key_3', - 1, - 1, - 350, - 'direct', - 'reward_address_4' -), -( - 6, - 'stake_public_key_5', - 1, - 'voting_key_5', - 1, - 1, - 250, - 'direct', - 'reward_address_5' + 1, + 'stake_public_key_1', + 1, + 'voting_key_1', + 1, + 1, + 140, + 'rep', + 'addrr_reward_address_1' +), +( + 2, + 'stake_public_key_2', + 1, + 'voting_key_1', + 1, + 1, + 110, + 'rep', + 'reward_address_2' +), +( + 3, + 'stake_public_key_1', + 1, + 'voting_key_2', + 1, + 1, + 100, + 'rep', + 'reward_address_1' +), +( + 4, + 'stake_public_key_3', + 1, + 'voting_key_2', + 1, + 1, + 50, + 'rep', + 'reward_address_3' +), +( + 5, + 'stake_public_key_4', + 1, + 'voting_key_3', + 1, + 1, + 350, + 'direct', + 'reward_address_4' +), +( + 6, + 'stake_public_key_5', + 1, + 'voting_key_5', + 1, + 1, + 250, + 'direct', + 'reward_address_5' ), ( - 7, - 'stake_public_key_1', - 2, - 'voting_key_1', - 1, - 1, - 140, - 'rep', - 'addrr_reward_address_1' -), -( - 8, - 'stake_public_key_2', - 2, - 'voting_key_1', - 1, - 1, - 110, - 'rep', - 'reward_address_2' -), -( - 9, - 'stake_public_key_1', - 2, - 'voting_key_2', - 1, - 1, - 100, - 'rep', - 'addrr_reward_address_1' -), -( - 10, - 'stake_public_key_3', - 2, - 'voting_key_2', - 1, - 1, - 50, - 'rep', - 'reward_address_3' -), -( - 11, - 'stake_public_key_4', - 2, - 'voting_key_3', - 1, - 1, - 350, - 'direct', - 'reward_address_4' -), -( - 12, - 'stake_public_key_5', - 2, - 'voting_key_5', - 1, - 1, - 250, - 'direct', - 'reward_address_5' + 7, + 'stake_public_key_1', + 2, + 'voting_key_1', + 1, + 1, + 140, + 'rep', + 'addrr_reward_address_1' +), +( + 8, + 'stake_public_key_2', + 2, + 'voting_key_1', + 1, + 1, + 110, + 'rep', + 'reward_address_2' +), +( + 9, + 'stake_public_key_1', + 2, + 'voting_key_2', + 1, + 1, + 100, + 'rep', + 'addrr_reward_address_1' +), +( + 10, + 'stake_public_key_3', + 2, + 'voting_key_2', + 1, + 1, + 50, + 'rep', + 'reward_address_3' +), +( + 11, + 'stake_public_key_4', + 2, + 'voting_key_3', + 1, + 1, + 350, + 'direct', + 'reward_address_4' +), +( + 12, + 'stake_public_key_5', + 2, + 'voting_key_5', + 1, + 1, + 250, + 'direct', + 'reward_address_5' ), ( - 13, - 'stake_public_key_1', - 3, - 'voting_key_1', - 1, - 1, - 140, - 'rep', - 'addrr_reward_address_1' -), -( - 14, - 'stake_public_key_2', - 3, - 'voting_key_1', - 1, - 1, - 110, - 'rep', - 'reward_address_2' -), -( - 15, - 'stake_public_key_1', - 3, - 'voting_key_2', - 1, - 1, - 100, - 'rep', - 'addrr_reward_address_1' -), -( - 16, - 'stake_public_key_3', - 3, - 'voting_key_2', - 1, - 1, - 50, - 'rep', - 'reward_address_4' -), -( - 17, - 'stake_public_key_4', - 3, - 'voting_key_3', - 1, - 1, - 350, - 'direct', - 'reward_address_5' -), -( - 18, - 'stake_public_key_5', - 3, - 'voting_key_5', - 1, - 1, - 250, - 'direct', - 'reward_address_5' + 13, + 'stake_public_key_1', + 3, + 'voting_key_1', + 1, + 1, + 140, + 'rep', + 'addrr_reward_address_1' +), +( + 14, + 'stake_public_key_2', + 3, + 'voting_key_1', + 1, + 1, + 110, + 'rep', + 'reward_address_2' +), +( + 15, + 'stake_public_key_1', + 3, + 'voting_key_2', + 1, + 1, + 100, + 'rep', + 'addrr_reward_address_1' +), +( + 16, + 'stake_public_key_3', + 3, + 'voting_key_2', + 1, + 1, + 50, + 'rep', + 'reward_address_4' +), +( + 17, + 'stake_public_key_4', + 3, + 'voting_key_3', + 1, + 1, + 350, + 'direct', + 'reward_address_5' +), +( + 18, + 'stake_public_key_5', + 3, + 'voting_key_5', + 1, + 1, + 250, + 'direct', + 'reward_address_5' ); diff --git a/catalyst-gateway/event-db/seed/test_data/06_objective_table.sql b/catalyst-gateway/event-db/seed/test_data/06_objective_table.sql index 0466b01ea6b..545c6933b73 100644 --- a/catalyst-gateway/event-db/seed/test_data/06_objective_table.sql +++ b/catalyst-gateway/event-db/seed/test_data/06_objective_table.sql @@ -1,51 +1,51 @@ INSERT INTO objective ( - row_id, - id, - event, - category, - title, - description, - rewards_currency, - rewards_total, - proposers_rewards, - vote_options, - extra + row_id, + id, + event, + category, + title, + description, + rewards_currency, + rewards_total, + proposers_rewards, + vote_options, + extra ) VALUES ( - 1, - 1, 1, - 'catalyst-simple', 'title 1', 'description 1', - 'ADA', 100, 100, 1, - '{ + 1, + 1, 1, + 'catalyst-simple', 'title 1', 'description 1', + 'ADA', 100, 100, 1, + '{ "url": "objective 1 url", "sponsor": "objective 1 sponsor", "video": "objective 1 video" }' ), ( - 2, - 2, 1, - 'catalyst-native', 'title 2', 'description 2', - null, null, null, null, - null + 2, + 2, 1, + 'catalyst-native', 'title 2', 'description 2', + null, null, null, null, + null ), ( - 3, - 3, 4, - 'catalyst-simple', 'title 3', 'description 3', - 'ADA', 100, 100, 1, - '{ + 3, + 3, 4, + 'catalyst-simple', 'title 3', 'description 3', + 'ADA', 100, 100, 1, + '{ "url": "objective 3 url", "sponsor": "objective 3 sponsor", "video": "objective 3 video" }' ), ( - 4, - 4, 4, - 'catalyst-native', 'title 4', 'description 4', - null, null, null, null, - null + 4, + 4, 4, + 'catalyst-native', 'title 4', 'description 4', + null, null, null, null, + null ); diff --git a/catalyst-gateway/event-db/seed/test_data/08_proposal_table.sql b/catalyst-gateway/event-db/seed/test_data/08_proposal_table.sql index 9e017161c64..e989cd127fe 100644 --- a/catalyst-gateway/event-db/seed/test_data/08_proposal_table.sql +++ b/catalyst-gateway/event-db/seed/test_data/08_proposal_table.sql @@ -1,153 +1,153 @@ INSERT INTO proposal ( - row_id, - id, - objective, - title, - summary, - category, - public_key, - funds, - url, - files_url, - impact_score, - extra, - proposer_name, - proposer_contact, - proposer_url, - proposer_relevant_experience, - bb_proposal_id + row_id, + id, + objective, + title, + summary, + category, + public_key, + funds, + url, + files_url, + impact_score, + extra, + proposer_name, + proposer_contact, + proposer_url, + proposer_relevant_experience, + bb_proposal_id ) VALUES ( - 1, - 10, - 1, - 'title 1', - 'summary 1', - 'category 1', - 'b7a3c12dc0c8c748ab07525b701122b88bd78f600c76342d27f25e5f92444cde', - 100, - 'url.xyz', - 'files.xyz', - 555, - '{ + 1, + 10, + 1, + 'title 1', + 'summary 1', + 'category 1', + 'b7a3c12dc0c8c748ab07525b701122b88bd78f600c76342d27f25e5f92444cde', + 100, + 'url.xyz', + 'files.xyz', + 555, + '{ "brief": "Brief explanation of a proposal", "importance": "The importance of the proposal", "goal": "The goal of the proposal is addressed to meet" }', - 'alice', - 'alice@io', - 'alice.prop.xyz', - 'alice is an attorney', - '70726f706f73616c' + 'alice', + 'alice@io', + 'alice.prop.xyz', + 'alice is an attorney', + '70726f706f73616c' ), ( - 2, - 20, - 1, - 'title 2', - 'summary 2', - 'category 2', - 'b7a3c12dc0c8c748ab07525b701122b88bd78f600c76342d27f25e5f92444cde', - 100, - 'url.xyz', - 'files.xyz', - 555, - '{ + 2, + 20, + 1, + 'title 2', + 'summary 2', + 'category 2', + 'b7a3c12dc0c8c748ab07525b701122b88bd78f600c76342d27f25e5f92444cde', + 100, + 'url.xyz', + 'files.xyz', + 555, + '{ "brief": "Brief explanation of a proposal", "importance": "The importance of the proposal", "goal": "The goal of the proposal is addressed to meet" }', - 'bob', - 'bob@io', - 'bob.prop.xyz', - 'bob is an accountant', - '70726f706f73616c' + 'bob', + 'bob@io', + 'bob.prop.xyz', + 'bob is an accountant', + '70726f706f73616c' ), ( - 3, - 30, - 1, - 'title 3', - 'summary 3', - 'category 3', - 'b7a3c12dc0c8c748ab07525b701122b88bd78f600c76342d27f25e5f92444cde', - 100, - 'url.xyz', - 'files.xyz', - 555, - '{ + 3, + 30, + 1, + 'title 3', + 'summary 3', + 'category 3', + 'b7a3c12dc0c8c748ab07525b701122b88bd78f600c76342d27f25e5f92444cde', + 100, + 'url.xyz', + 'files.xyz', + 555, + '{ "brief": "Brief explanation of a proposal", "importance": "The importance of the proposal", "goal": "The goal of the proposal is addressed to meet" }', - 'bob', - 'bob@io', - 'bob.prop.xyz', - 'bob is an accountant', - '70726f706f73616c' + 'bob', + 'bob@io', + 'bob.prop.xyz', + 'bob is an accountant', + '70726f706f73616c' ), ( - 4, - 10, - 2, - 'title 1', - 'summary 1', - 'category 1', - 'b7a3c12dc0c8c748ab07525b701122b88bd78f600c76342d27f25e5f92444cde', - 100, - 'url.xyz', - 'files.xyz', - 555, - '{ + 4, + 10, + 2, + 'title 1', + 'summary 1', + 'category 1', + 'b7a3c12dc0c8c748ab07525b701122b88bd78f600c76342d27f25e5f92444cde', + 100, + 'url.xyz', + 'files.xyz', + 555, + '{ "brief": "Brief explanation of a proposal", "importance": "The importance of the proposal", "goal": "The goal of the proposal is addressed to meet" }', - 'alice', - 'alice@io', - 'alice.prop.xyz', - 'alice is an attorney', - '70726f706f73616c' + 'alice', + 'alice@io', + 'alice.prop.xyz', + 'alice is an attorney', + '70726f706f73616c' ), ( - 5, - 20, - 2, - 'title 2', - 'summary 2', - 'category 2', - 'b7a3c12dc0c8c748ab07525b701122b88bd78f600c76342d27f25e5f92444cde', - 100, - 'url.xyz', - 'files.xyz', - 555, - '{ + 5, + 20, + 2, + 'title 2', + 'summary 2', + 'category 2', + 'b7a3c12dc0c8c748ab07525b701122b88bd78f600c76342d27f25e5f92444cde', + 100, + 'url.xyz', + 'files.xyz', + 555, + '{ "brief": "Brief explanation of a proposal", "importance": "The importance of the proposal", "goal": "The goal of the proposal is addressed to meet" }', - 'bob', - 'bob@io', - 'bob.prop.xyz', - 'bob is an accountant', - '70726f706f73616c' + 'bob', + 'bob@io', + 'bob.prop.xyz', + 'bob is an accountant', + '70726f706f73616c' ), ( - 6, - 30, - 2, - 'title 3', - 'summary 3', - 'category 3', - 'b7a3c12dc0c8c748ab07525b701122b88bd78f600c76342d27f25e5f92444cde', - 100, - 'url.xyz', - 'files.xyz', - 555, - '{ + 6, + 30, + 2, + 'title 3', + 'summary 3', + 'category 3', + 'b7a3c12dc0c8c748ab07525b701122b88bd78f600c76342d27f25e5f92444cde', + 100, + 'url.xyz', + 'files.xyz', + 555, + '{ "brief": "Brief explanation of a proposal", "importance": "The importance of the proposal", "goal": "The goal of the proposal is addressed to meet" }', - 'bob', - 'bob@io', - 'bob.prop.xyz', - 'bob is an accountant', - '70726f706f73616c' + 'bob', + 'bob@io', + 'bob.prop.xyz', + 'bob is an accountant', + '70726f706f73616c' ); diff --git a/catalyst-gateway/event-db/seed/test_data/09_proposal_review_table.sql b/catalyst-gateway/event-db/seed/test_data/09_proposal_review_table.sql index f6969e85fb8..1b18291a24e 100644 --- a/catalyst-gateway/event-db/seed/test_data/09_proposal_review_table.sql +++ b/catalyst-gateway/event-db/seed/test_data/09_proposal_review_table.sql @@ -1,19 +1,19 @@ INSERT INTO proposal_review ( - row_id, - proposal_id, - assessor + row_id, + proposal_id, + assessor ) VALUES ( - 1, - 1, - 'assessor 1' + 1, + 1, + 'assessor 1' ), ( - 2, - 1, - 'assessor 2' + 2, + 1, + 'assessor 2' ), ( - 3, - 1, - 'assessor 3' + 3, + 1, + 'assessor 3' ); diff --git a/catalyst-gateway/event-db/seed/test_data/10_review_rating_table.sql b/catalyst-gateway/event-db/seed/test_data/10_review_rating_table.sql index 0fa2f64faf4..954c0b41e88 100644 --- a/catalyst-gateway/event-db/seed/test_data/10_review_rating_table.sql +++ b/catalyst-gateway/event-db/seed/test_data/10_review_rating_table.sql @@ -1,27 +1,27 @@ INSERT INTO review_rating ( - row_id, - review_id, - metric, - rating, - note + row_id, + review_id, + metric, + rating, + note ) VALUES ( - 1, - 1, - 1, - 10, - 'note 1' + 1, + 1, + 1, + 10, + 'note 1' ), ( - 2, - 1, - 2, - 15, - 'note 2' + 2, + 1, + 2, + 15, + 'note 2' ), ( - 3, - 1, - 5, - 20, - 'note 3' + 3, + 1, + 5, + 20, + 'note 3' ); diff --git a/catalyst-gateway/event-db/seed/test_data/11_objective_review_metric_table.sql b/catalyst-gateway/event-db/seed/test_data/11_objective_review_metric_table.sql index 8c74753605e..aeab0380b59 100644 --- a/catalyst-gateway/event-db/seed/test_data/11_objective_review_metric_table.sql +++ b/catalyst-gateway/event-db/seed/test_data/11_objective_review_metric_table.sql @@ -1,27 +1,27 @@ INSERT INTO objective_review_metric ( - row_id, - objective, - metric, - note, - review_group + row_id, + objective, + metric, + note, + review_group ) VALUES ( - 1, - 1, - 1, - null, - 'review_group 1' + 1, + 1, + 1, + null, + 'review_group 1' ), ( - 2, - 1, - 2, - true, - 'review_group 2' + 2, + 1, + 2, + true, + 'review_group 2' ), ( - 3, - 1, - 5, - false, - null + 3, + 1, + 5, + false, + null );