From b26de6ed048ded14f8b7c9e77a0eb03209356570 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Wed, 26 Jul 2023 14:05:45 +0700 Subject: [PATCH 01/13] fix: Only gitignore local when its in the root of the repo. --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 0d60ef54ca..e6921a29aa 100644 --- a/.gitignore +++ b/.gitignore @@ -117,4 +117,4 @@ lefthook.yml treefmt.toml # local earthly Environments -local/ +./local/ From ab067d7040cd16d4a2db7573823af8e83fd6fe10 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Wed, 26 Jul 2023 14:06:52 +0700 Subject: [PATCH 02/13] Add structure for defining stage specific data for the DB --- src/event-db/stage_data/Readme.md | 12 ++++++++++++ src/event-db/stage_data/dev/.gitignore | 5 +++++ src/event-db/stage_data/local/.gitignore | 4 ++++ src/event-db/stage_data/preprod/.gitignore | 5 +++++ src/event-db/stage_data/prod/.gitignore | 5 +++++ src/event-db/stage_data/testnet/.gitignore | 5 +++++ 6 files changed, 36 insertions(+) create mode 100644 src/event-db/stage_data/Readme.md create mode 100644 src/event-db/stage_data/dev/.gitignore create mode 100644 src/event-db/stage_data/local/.gitignore create mode 100644 src/event-db/stage_data/preprod/.gitignore create mode 100644 src/event-db/stage_data/prod/.gitignore create mode 100644 src/event-db/stage_data/testnet/.gitignore diff --git a/src/event-db/stage_data/Readme.md b/src/event-db/stage_data/Readme.md new file mode 100644 index 0000000000..1ea1055789 --- /dev/null +++ b/src/event-db/stage_data/Readme.md @@ -0,0 +1,12 @@ +# Stage Specific Data + +Subdirectories in this directory, that are named the same as a deployment stage will have their `.sql` files applied to the database when it is configured. + +* `dev` - Development Environment specific data. +* `testnet` - Test-Net Environment specific data. +* `preprod` - Preprod Environment specific data. +* `prod` - Production Environment specific data. +* `local` - Local Testing Environment specific data. Does not get checked in to git, local only. + +Each directory can only contain `*.sql` files. +They will be applied in sorted order. diff --git a/src/event-db/stage_data/dev/.gitignore b/src/event-db/stage_data/dev/.gitignore new file mode 100644 index 0000000000..f6893d3d19 --- /dev/null +++ b/src/event-db/stage_data/dev/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* +# Except these files +!.gitignore +!*.sql \ No newline at end of file diff --git a/src/event-db/stage_data/local/.gitignore b/src/event-db/stage_data/local/.gitignore new file mode 100644 index 0000000000..86d0cb2726 --- /dev/null +++ b/src/event-db/stage_data/local/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore \ No newline at end of file diff --git a/src/event-db/stage_data/preprod/.gitignore b/src/event-db/stage_data/preprod/.gitignore new file mode 100644 index 0000000000..f6893d3d19 --- /dev/null +++ b/src/event-db/stage_data/preprod/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* +# Except these files +!.gitignore +!*.sql \ No newline at end of file diff --git a/src/event-db/stage_data/prod/.gitignore b/src/event-db/stage_data/prod/.gitignore new file mode 100644 index 0000000000..f6893d3d19 --- /dev/null +++ b/src/event-db/stage_data/prod/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* +# Except these files +!.gitignore +!*.sql \ No newline at end of file diff --git a/src/event-db/stage_data/testnet/.gitignore b/src/event-db/stage_data/testnet/.gitignore new file mode 100644 index 0000000000..f6893d3d19 --- /dev/null +++ b/src/event-db/stage_data/testnet/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* +# Except these files +!.gitignore +!*.sql \ No newline at end of file From 51067034151748b084991f5755b00d30b0061893 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Wed, 26 Jul 2023 14:07:29 +0700 Subject: [PATCH 03/13] feat: Add stage specific data to the db setup container --- src/event-db/Earthfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/event-db/Earthfile b/src/event-db/Earthfile index c91448a36b..0fde323ca1 100644 --- a/src/event-db/Earthfile +++ b/src/event-db/Earthfile @@ -12,6 +12,7 @@ build: COPY --dir migrations . # Copy the migrations directory to the working directory COPY --dir historic_data . # Copy the historic_data directory to the working directory COPY --dir test_data . # Copy the test_data directory to the working directory + COPY --dir stage_data . # Copy Stage specific data into the working directory. RUN python3 historic_data/fund_2/mk_fund2_sql.py historic_data/fund_2/fund2_database_encrypted.sqlite3 >> historic_data/fund_2.sql RUN python3 historic_data/fund_3/mk_fund3_sql.py historic_data/fund_3/fund3_database_encrypted.sqlite3 >> historic_data/fund_3.sql @@ -30,7 +31,7 @@ build: SAVE ARTIFACT test_data # Save the test_data directory as an artifact docker-compose: - FROM scratch + FROM scratch COPY docker-compose.yml . SAVE ARTIFACT docker-compose.yml From e3e4f96b64187a4c2f0ea701784d18513b7e671d Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Wed, 26 Jul 2023 14:07:57 +0700 Subject: [PATCH 04/13] feat: load stage specific data if it exists, and is not skipped. --- containers/event-db-migrations/entry.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/containers/event-db-migrations/entry.sh b/containers/event-db-migrations/entry.sh index f9ad18dfdc..1b2ac8d04b 100644 --- a/containers/event-db-migrations/entry.sh +++ b/containers/event-db-migrations/entry.sh @@ -19,6 +19,7 @@ # DB_USER_PASSWORD - The password of the database user # DB_SKIP_HISTORICAL_DATA - If set, historical data will not be added to the database (optional) # DB_SKIP_TEST_DATA - If set, test data will not be added to the database (optional) +# DB_SKIP_STAGE_DATA - If set, stage specific data will not be added to the database (optional) # ADMIN_ROLE_PASSWORD - The password of the cat_admin role for graphql # ADMIN_USER_PASSWORD - The password of the admin user for graphql # ANON_ROLE_PASSWORD - The password of the cat_anon role for graphql @@ -31,6 +32,7 @@ # SKIP_GRAPHQL_INIT - If set, graphql will not be initialized (optional) # DEBUG - If set, the script will print debug information (optional) # DEBUG_SLEEP - If set, the script will sleep for the specified number of seconds (optional) +# STAGE - The stage being run. Currnelty only controls if stage specific data is applied to the DB (optional) # --------------------------------------------------------------- set +x set -o errexit @@ -145,6 +147,20 @@ if [[ -z "${DB_SKIP_HISTORICAL_DATA:-}" ]]; then done < <(find ./historic_data -name '*.sql' -print0 | sort -z) fi +# Add stage specific data to the DB when initialized. +if [[ -z "${DB_SKIP_STAGE_DATA:-}" ]]; then + if [[ -d "$STAGE_DATA" ]]; then + STAGE_DATA = "./stage_data/$STAGE" + else + STAGE_DATA = "./stage_data/local" + fi + + while IFS= read -r -d '' file; do + echo "Adding stage specific data from $file" + psql -f "$file" + done < <(find "$STAGE_DATA" -name '*.sql' -print0 | sort -z) +fi + # Add test data if [[ -z "${DB_SKIP_TEST_DATA:-}" ]]; then while IFS= read -r -d '' file; do From 92cd2c053297c3fcfcaf127856d7f004b0146ae3 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Wed, 26 Jul 2023 14:05:45 +0700 Subject: [PATCH 05/13] fix: Only gitignore local when its in the root of the repo. --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 0d60ef54ca..e6921a29aa 100644 --- a/.gitignore +++ b/.gitignore @@ -117,4 +117,4 @@ lefthook.yml treefmt.toml # local earthly Environments -local/ +./local/ From ddca820715d2302c62c04abbb217f604970b4639 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Wed, 26 Jul 2023 14:06:52 +0700 Subject: [PATCH 06/13] Add structure for defining stage specific data for the DB --- src/event-db/stage_data/Readme.md | 12 ++++++++++++ src/event-db/stage_data/dev/.gitignore | 5 +++++ src/event-db/stage_data/local/.gitignore | 4 ++++ src/event-db/stage_data/preprod/.gitignore | 5 +++++ src/event-db/stage_data/prod/.gitignore | 5 +++++ src/event-db/stage_data/testnet/.gitignore | 5 +++++ 6 files changed, 36 insertions(+) create mode 100644 src/event-db/stage_data/Readme.md create mode 100644 src/event-db/stage_data/dev/.gitignore create mode 100644 src/event-db/stage_data/local/.gitignore create mode 100644 src/event-db/stage_data/preprod/.gitignore create mode 100644 src/event-db/stage_data/prod/.gitignore create mode 100644 src/event-db/stage_data/testnet/.gitignore diff --git a/src/event-db/stage_data/Readme.md b/src/event-db/stage_data/Readme.md new file mode 100644 index 0000000000..1ea1055789 --- /dev/null +++ b/src/event-db/stage_data/Readme.md @@ -0,0 +1,12 @@ +# Stage Specific Data + +Subdirectories in this directory, that are named the same as a deployment stage will have their `.sql` files applied to the database when it is configured. + +* `dev` - Development Environment specific data. +* `testnet` - Test-Net Environment specific data. +* `preprod` - Preprod Environment specific data. +* `prod` - Production Environment specific data. +* `local` - Local Testing Environment specific data. Does not get checked in to git, local only. + +Each directory can only contain `*.sql` files. +They will be applied in sorted order. diff --git a/src/event-db/stage_data/dev/.gitignore b/src/event-db/stage_data/dev/.gitignore new file mode 100644 index 0000000000..f6893d3d19 --- /dev/null +++ b/src/event-db/stage_data/dev/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* +# Except these files +!.gitignore +!*.sql \ No newline at end of file diff --git a/src/event-db/stage_data/local/.gitignore b/src/event-db/stage_data/local/.gitignore new file mode 100644 index 0000000000..86d0cb2726 --- /dev/null +++ b/src/event-db/stage_data/local/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore \ No newline at end of file diff --git a/src/event-db/stage_data/preprod/.gitignore b/src/event-db/stage_data/preprod/.gitignore new file mode 100644 index 0000000000..f6893d3d19 --- /dev/null +++ b/src/event-db/stage_data/preprod/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* +# Except these files +!.gitignore +!*.sql \ No newline at end of file diff --git a/src/event-db/stage_data/prod/.gitignore b/src/event-db/stage_data/prod/.gitignore new file mode 100644 index 0000000000..f6893d3d19 --- /dev/null +++ b/src/event-db/stage_data/prod/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* +# Except these files +!.gitignore +!*.sql \ No newline at end of file diff --git a/src/event-db/stage_data/testnet/.gitignore b/src/event-db/stage_data/testnet/.gitignore new file mode 100644 index 0000000000..f6893d3d19 --- /dev/null +++ b/src/event-db/stage_data/testnet/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* +# Except these files +!.gitignore +!*.sql \ No newline at end of file From a7a53dcc3b8681c3481a6b5b817c6258e289b209 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Wed, 26 Jul 2023 14:07:29 +0700 Subject: [PATCH 07/13] feat: Add stage specific data to the db setup container --- src/event-db/Earthfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/event-db/Earthfile b/src/event-db/Earthfile index c91448a36b..0fde323ca1 100644 --- a/src/event-db/Earthfile +++ b/src/event-db/Earthfile @@ -12,6 +12,7 @@ build: COPY --dir migrations . # Copy the migrations directory to the working directory COPY --dir historic_data . # Copy the historic_data directory to the working directory COPY --dir test_data . # Copy the test_data directory to the working directory + COPY --dir stage_data . # Copy Stage specific data into the working directory. RUN python3 historic_data/fund_2/mk_fund2_sql.py historic_data/fund_2/fund2_database_encrypted.sqlite3 >> historic_data/fund_2.sql RUN python3 historic_data/fund_3/mk_fund3_sql.py historic_data/fund_3/fund3_database_encrypted.sqlite3 >> historic_data/fund_3.sql @@ -30,7 +31,7 @@ build: SAVE ARTIFACT test_data # Save the test_data directory as an artifact docker-compose: - FROM scratch + FROM scratch COPY docker-compose.yml . SAVE ARTIFACT docker-compose.yml From 385e5c5d70aa21b67a02098479d4607f75a10c78 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Wed, 26 Jul 2023 14:07:57 +0700 Subject: [PATCH 08/13] feat: load stage specific data if it exists, and is not skipped. --- containers/event-db-migrations/entry.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/containers/event-db-migrations/entry.sh b/containers/event-db-migrations/entry.sh index f9ad18dfdc..1b2ac8d04b 100644 --- a/containers/event-db-migrations/entry.sh +++ b/containers/event-db-migrations/entry.sh @@ -19,6 +19,7 @@ # DB_USER_PASSWORD - The password of the database user # DB_SKIP_HISTORICAL_DATA - If set, historical data will not be added to the database (optional) # DB_SKIP_TEST_DATA - If set, test data will not be added to the database (optional) +# DB_SKIP_STAGE_DATA - If set, stage specific data will not be added to the database (optional) # ADMIN_ROLE_PASSWORD - The password of the cat_admin role for graphql # ADMIN_USER_PASSWORD - The password of the admin user for graphql # ANON_ROLE_PASSWORD - The password of the cat_anon role for graphql @@ -31,6 +32,7 @@ # SKIP_GRAPHQL_INIT - If set, graphql will not be initialized (optional) # DEBUG - If set, the script will print debug information (optional) # DEBUG_SLEEP - If set, the script will sleep for the specified number of seconds (optional) +# STAGE - The stage being run. Currnelty only controls if stage specific data is applied to the DB (optional) # --------------------------------------------------------------- set +x set -o errexit @@ -145,6 +147,20 @@ if [[ -z "${DB_SKIP_HISTORICAL_DATA:-}" ]]; then done < <(find ./historic_data -name '*.sql' -print0 | sort -z) fi +# Add stage specific data to the DB when initialized. +if [[ -z "${DB_SKIP_STAGE_DATA:-}" ]]; then + if [[ -d "$STAGE_DATA" ]]; then + STAGE_DATA = "./stage_data/$STAGE" + else + STAGE_DATA = "./stage_data/local" + fi + + while IFS= read -r -d '' file; do + echo "Adding stage specific data from $file" + psql -f "$file" + done < <(find "$STAGE_DATA" -name '*.sql' -print0 | sort -z) +fi + # Add test data if [[ -z "${DB_SKIP_TEST_DATA:-}" ]]; then while IFS= read -r -d '' file; do From e61f75233c873eae0ccd62ae3c3db2c4bf3ff987 Mon Sep 17 00:00:00 2001 From: Felipe Rosa Date: Mon, 31 Jul 2023 10:30:35 -0300 Subject: [PATCH 09/13] feat: Add stage specific ideascale params data --- containers/event-db-migrations/Earthfile | 1 + containers/event-db-migrations/entry.sh | 6 +++--- src/event-db/Earthfile | 1 + src/event-db/migrations/V1__config_tables.sql | 16 ++++++++++++++-- .../testnet/00001_fund10_ideascale_params.sql | 18 ++++++++++++++++++ 5 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 src/event-db/stage_data/testnet/00001_fund10_ideascale_params.sql diff --git a/containers/event-db-migrations/Earthfile b/containers/event-db-migrations/Earthfile index 43d89a9447..afc8885937 100644 --- a/containers/event-db-migrations/Earthfile +++ b/containers/event-db-migrations/Earthfile @@ -45,6 +45,7 @@ docker: COPY --dir ../../src/event-db+build/test_data ./test_data END COPY ../../src/event-db+build/refinery.toml . + COPY ../../src/event-db+build/stage_data ./stage_data VOLUME /eventdb/tmp COPY ./entry.sh . diff --git a/containers/event-db-migrations/entry.sh b/containers/event-db-migrations/entry.sh index 1b2ac8d04b..f72a9997b9 100644 --- a/containers/event-db-migrations/entry.sh +++ b/containers/event-db-migrations/entry.sh @@ -149,10 +149,10 @@ fi # Add stage specific data to the DB when initialized. if [[ -z "${DB_SKIP_STAGE_DATA:-}" ]]; then - if [[ -d "$STAGE_DATA" ]]; then - STAGE_DATA = "./stage_data/$STAGE" + if [[ -n "$STAGE" ]]; then + STAGE_DATA="./stage_data/$STAGE" else - STAGE_DATA = "./stage_data/local" + STAGE_DATA="./stage_data/local" fi while IFS= read -r -d '' file; do diff --git a/src/event-db/Earthfile b/src/event-db/Earthfile index 0fde323ca1..40b54f043c 100644 --- a/src/event-db/Earthfile +++ b/src/event-db/Earthfile @@ -29,6 +29,7 @@ build: SAVE ARTIFACT migrations # Save the migrations directory as an artifact SAVE ARTIFACT historic_data # Save the historic_data directory as an artifact SAVE ARTIFACT test_data # Save the test_data directory as an artifact + SAVE ARTIFACT stage_data # Save the stage_data directory as an artifact docker-compose: FROM scratch diff --git a/src/event-db/migrations/V1__config_tables.sql b/src/event-db/migrations/V1__config_tables.sql index 5706d389fb..39d86ecec8 100644 --- a/src/event-db/migrations/V1__config_tables.sql +++ b/src/event-db/migrations/V1__config_tables.sql @@ -41,7 +41,7 @@ Defined Data Formats: `value`->"created" = , `value`->"expires" = , `value`->"perms" = {Permissions assigned to this api key} - + Community reviewers: `id` = `email` `id2` = `encrypted_password` @@ -51,7 +51,19 @@ Defined Data Formats: `value`->"anonymous_id" = `` `value`->"force_reset" = "" `value`->"active" = "" - ... + + IdeaScale parameters: + `id` = "ideascale" + `id2` = "params" + `id3` = + `value`->"campaign_group_id" = + `value`->"stage_ids" = + + Event IdeaScale parameters: + `id` = "event" + `id2` = "ideascale_params" + `id3` = + `value`->"params_id" = '; COMMENT ON COLUMN config.row_id IS diff --git a/src/event-db/stage_data/testnet/00001_fund10_ideascale_params.sql b/src/event-db/stage_data/testnet/00001_fund10_ideascale_params.sql new file mode 100644 index 0000000000..fcce721bec --- /dev/null +++ b/src/event-db/stage_data/testnet/00001_fund10_ideascale_params.sql @@ -0,0 +1,18 @@ +-- Define F10 IdeaScale parameters. +INSERT INTO config (id, id2, id3, value) VALUES ( + 'ideascale', + 'params', + 'F10', + '{ + "campaign_group_id": 63, + "stage_ids": [4590, 4596, 4602, 4608, 4614, 4620, 4626, 4632, 4638, 4644, 4650, 4656, 4662] + }' +); + +-- Use F10 params for event with row_id = 10. +INSERT INTO config (id, id2, id3, value) VALUES ( + 'event', + 'ideascale_params', + '10', + '{"params_id": "F10"}' +); From b1a4c77d2ef5753cf71d25e08bca41d832faa433 Mon Sep 17 00:00:00 2001 From: Felipe Rosa Date: Tue, 1 Aug 2023 12:39:02 -0300 Subject: [PATCH 10/13] feat: Add stage specific ideascale params data for dev and F10 data for testnet+dev --- .../stage_data/dev/00001_fund10_event.sql | 54 +++++++++++++++++++ .../00002_fund10_ideascale_params.sql} | 0 .../stage_data/testnet/00001_fund10_event.sql | 53 ++++++++++++++++++ .../testnet/00002_fund10_ideascale_params.sql | 18 +++++++ 4 files changed, 125 insertions(+) create mode 100644 src/event-db/stage_data/dev/00001_fund10_event.sql rename src/event-db/stage_data/{testnet/00001_fund10_ideascale_params.sql => dev/00002_fund10_ideascale_params.sql} (100%) create mode 100644 src/event-db/stage_data/testnet/00001_fund10_event.sql create mode 100644 src/event-db/stage_data/testnet/00002_fund10_ideascale_params.sql diff --git a/src/event-db/stage_data/dev/00001_fund10_event.sql b/src/event-db/stage_data/dev/00001_fund10_event.sql new file mode 100644 index 0000000000..073c766a40 --- /dev/null +++ b/src/event-db/stage_data/dev/00001_fund10_event.sql @@ -0,0 +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 +) VALUES ( + 10, + 'Fund 10', + 'Fund 10 Description', + '2023-08-18 00:00:00', + '2023-08-23 00:00:00', + 450000000, + 1, + NULL, + '2023-06-16 19:56:00', + '2023-09-18 00:00:00', + '2023-06-22 00:00:00', + '2023-06-22 00:00:00', + '2023-06-22 00:00:00', + '2023-07-13 00:00:00', + '2023-07-20 00:00:00', + '2023-08-10 00:00:00', + '2023-08-31 00:00:00', + '2023-09-14 00:00:00', + '2023-09-18 00:00:00', + NULL, + NULL, + 10, + 7, + NULL, + NULL +); diff --git a/src/event-db/stage_data/testnet/00001_fund10_ideascale_params.sql b/src/event-db/stage_data/dev/00002_fund10_ideascale_params.sql similarity index 100% rename from src/event-db/stage_data/testnet/00001_fund10_ideascale_params.sql rename to src/event-db/stage_data/dev/00002_fund10_ideascale_params.sql diff --git a/src/event-db/stage_data/testnet/00001_fund10_event.sql b/src/event-db/stage_data/testnet/00001_fund10_event.sql new file mode 100644 index 0000000000..169900170c --- /dev/null +++ b/src/event-db/stage_data/testnet/00001_fund10_event.sql @@ -0,0 +1,53 @@ +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 +) VALUES ( + 10, + 'Fund 10', + 'Fund 10 Description', + '2023-08-18 00:00:00', + '2023-08-23 00:00:00', + 450000000, + 1, + NULL, + '2023-06-16 19:56:00', + '2023-09-18 00:00:00', + '2023-06-22 00:00:00', + '2023-06-22 00:00:00', + '2023-06-22 00:00:00', + '2023-07-13 00:00:00', + '2023-07-20 00:00:00', + '2023-08-10 00:00:00', + '2023-08-31 00:00:00', + '2023-09-14 00:00:00', + '2023-09-18 00:00:00', + NULL, + NULL, + 10, + 7, + NULL, + NULL +); diff --git a/src/event-db/stage_data/testnet/00002_fund10_ideascale_params.sql b/src/event-db/stage_data/testnet/00002_fund10_ideascale_params.sql new file mode 100644 index 0000000000..fcce721bec --- /dev/null +++ b/src/event-db/stage_data/testnet/00002_fund10_ideascale_params.sql @@ -0,0 +1,18 @@ +-- Define F10 IdeaScale parameters. +INSERT INTO config (id, id2, id3, value) VALUES ( + 'ideascale', + 'params', + 'F10', + '{ + "campaign_group_id": 63, + "stage_ids": [4590, 4596, 4602, 4608, 4614, 4620, 4626, 4632, 4638, 4644, 4650, 4656, 4662] + }' +); + +-- Use F10 params for event with row_id = 10. +INSERT INTO config (id, id2, id3, value) VALUES ( + 'event', + 'ideascale_params', + '10', + '{"params_id": "F10"}' +); From b0d4b53e71cd220a7051313f161d71adc38da6f7 Mon Sep 17 00:00:00 2001 From: Felipe Rosa Date: Tue, 1 Aug 2023 16:19:25 -0300 Subject: [PATCH 11/13] chore: fix typo --- containers/event-db-migrations/entry.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers/event-db-migrations/entry.sh b/containers/event-db-migrations/entry.sh index f72a9997b9..0de7709ad4 100644 --- a/containers/event-db-migrations/entry.sh +++ b/containers/event-db-migrations/entry.sh @@ -32,7 +32,7 @@ # SKIP_GRAPHQL_INIT - If set, graphql will not be initialized (optional) # DEBUG - If set, the script will print debug information (optional) # DEBUG_SLEEP - If set, the script will sleep for the specified number of seconds (optional) -# STAGE - The stage being run. Currnelty only controls if stage specific data is applied to the DB (optional) +# STAGE - The stage being run. Currently only controls if stage specific data is applied to the DB (optional) # --------------------------------------------------------------- set +x set -o errexit From 94e24428d3727f8f1bc3ea29e0fd592b4f7cfa5c Mon Sep 17 00:00:00 2001 From: Felipe Rosa Date: Tue, 1 Aug 2023 19:09:20 -0300 Subject: [PATCH 12/13] chore: remove Fund 10 historic data --- src/event-db/historic_data/fund_10.sql | 51 -------------------------- 1 file changed, 51 deletions(-) delete mode 100644 src/event-db/historic_data/fund_10.sql diff --git a/src/event-db/historic_data/fund_10.sql b/src/event-db/historic_data/fund_10.sql deleted file mode 100644 index 71ae1be461..0000000000 --- a/src/event-db/historic_data/fund_10.sql +++ /dev/null @@ -1,51 +0,0 @@ --- Data from Catalyst Fund 10 - Public Pilot Run - --- Purge all Fund 1 data before re-inserting it. -DELETE FROM event WHERE row_id = 10; - --- Create the Event record for Fund 0 - -INSERT INTO event -(row_id, name, description, - start_time, - end_time, - registration_snapshot_time, - snapshot_start, - voting_power_threshold, - max_voting_power_pct, - 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 - -(10, 'Catalyst Fund 10', 'Test Fund 10 data', - '2020-08-08 00:00:00', -- Start Time - Date accurate, time not known. - '2020-09-22 00:00:00', -- End Time - Date accurate, time not known. - '2020-09-14 12:00:05', -- Registration Snapshot Time - Slot 8518514 - '2020-09-15 00:00:00', -- Snapshot Start - Date/time not known. - 1, -- Voting Power Threshold - Unknown, assume 1 - 100, -- Max Voting Power PCT - No max% threshold used in this fund. - NULL, -- Insight Sharing Start - None - '2020-08-08 00:00:00', -- Proposal Submission Start - Date accurate, time not known. - NULL, -- Refine Proposals Start - Date accurate, time not known. - '2020-09-11 00:00:00', -- Finalize Proposals Start - Date accurate, time not known. - NULL, -- Proposal Assessment Start - None - NULL, -- Assessment QA Start - None - '2020-09-17 00:00:00', -- Voting Starts - Date Accurate, time not known. - '2020-09-21 00:00:00', -- Voting Ends - Date Accurate, time not known. - '2020-09-22 23:59:00', -- Tallying Ends - Date Accurate, time not known. - NULL, -- Block 0 Data - Not Known - NULL, -- Block 0 Hash - Not Known - 0, -- Committee Size - Not Known - 0 -- Committee Threshold - Not Known - ); From a5b2670f0eb758638f9ae31c40f7499a9fb838e6 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Wed, 2 Aug 2023 12:56:54 +0700 Subject: [PATCH 13/13] fix: Fix Committee size and deadlines to F10 parameters where known. --- .../stage_data/dev/00001_fund10_event.sql | 48 +++++++++--------- .../stage_data/testnet/00001_fund10_event.sql | 49 ++++++++++--------- 2 files changed, 49 insertions(+), 48 deletions(-) diff --git a/src/event-db/stage_data/dev/00001_fund10_event.sql b/src/event-db/stage_data/dev/00001_fund10_event.sql index 073c766a40..ba0040932f 100644 --- a/src/event-db/stage_data/dev/00001_fund10_event.sql +++ b/src/event-db/stage_data/dev/00001_fund10_event.sql @@ -28,27 +28,27 @@ INSERT INTO event ( ) VALUES ( 10, 'Fund 10', - 'Fund 10 Description', - '2023-08-18 00:00:00', - '2023-08-23 00:00:00', - 450000000, - 1, - NULL, - '2023-06-16 19:56:00', - '2023-09-18 00:00:00', - '2023-06-22 00:00:00', - '2023-06-22 00:00:00', - '2023-06-22 00:00:00', - '2023-07-13 00:00:00', - '2023-07-20 00:00:00', - '2023-08-10 00:00:00', - '2023-08-31 00:00:00', - '2023-09-14 00:00:00', - '2023-09-18 00:00:00', - NULL, - NULL, - 10, - 7, - NULL, - NULL -); + 'Catalyst Dev Environment - 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 +); \ No newline at end of file diff --git a/src/event-db/stage_data/testnet/00001_fund10_event.sql b/src/event-db/stage_data/testnet/00001_fund10_event.sql index 169900170c..8b6f0cb6c3 100644 --- a/src/event-db/stage_data/testnet/00001_fund10_event.sql +++ b/src/event-db/stage_data/testnet/00001_fund10_event.sql @@ -1,3 +1,4 @@ +-- F10 INSERT INTO event ( row_id, name, @@ -27,27 +28,27 @@ INSERT INTO event ( ) VALUES ( 10, 'Fund 10', - 'Fund 10 Description', - '2023-08-18 00:00:00', - '2023-08-23 00:00:00', - 450000000, - 1, - NULL, - '2023-06-16 19:56:00', - '2023-09-18 00:00:00', - '2023-06-22 00:00:00', - '2023-06-22 00:00:00', - '2023-06-22 00:00:00', - '2023-07-13 00:00:00', - '2023-07-20 00:00:00', - '2023-08-10 00:00:00', - '2023-08-31 00:00:00', - '2023-09-14 00:00:00', - '2023-09-18 00:00:00', - NULL, - NULL, - 10, - 7, - NULL, - NULL -); + '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 +); \ No newline at end of file