Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add new columns in schema.sql #469

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

wa0x6e
Copy link
Contributor

@wa0x6e wa0x6e commented Nov 4, 2024

Fix #468

Updated schema.sql proposals to match with production database state

Added missing columns:

  • scores_total_value
  • vp_value_by_strategy

Added missing DEFAULT to columns with default

Added missing INDEX

@wa0x6e wa0x6e requested a review from ChaituVR November 4, 2024 05:03
@wa0x6e wa0x6e changed the title fix: add new columns in schema.sq fix: add new columns in schema.sql Nov 4, 2024
@wa0x6e wa0x6e marked this pull request as ready for review November 4, 2024 05:03
@wa0x6e wa0x6e mentioned this pull request Nov 18, 2024
2 tasks
@wa0x6e
Copy link
Contributor Author

wa0x6e commented Nov 30, 2024

Any updates on this one ? Some tests are failing without this

@ChaituVR
Copy link
Member

As far as I remember @bonustrack asked us to wait, but I'm not sure exactly. Do you think we can proceed? @bonustrack

@bonustrack
Copy link
Member

I've changed the new types on the proposals table to be:
image
If you can update it, then all good for me. Later I'll also add some types on the votes table

Copy link

codecov bot commented Dec 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Additional details and impacted files

📢 Thoughts on this report? Let us know!

@wa0x6e
Copy link
Contributor Author

wa0x6e commented Dec 1, 2024

Updated

@@ -29,15 +29,15 @@ CREATE TABLE spaces (
);

CREATE TABLE proposals (
id VARCHAR(66) NOT NULL,
ipfs VARCHAR(64) NOT NULL,
id VARCHAR(66) NOT NULL DEFAULT '',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think we should have default values, specially with id we always want it to be random
any reason to add default values?

also not sure we want to update our prod DB with these 🙈 better to change schema of new values only? 😅

Copy link
Contributor Author

@wa0x6e wa0x6e Dec 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is just updating the schema to mirror the current existing values.

Production database proposals table schema is :

CREATE TABLE "proposals" (
  "id" varchar(66) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_as_cs NOT NULL DEFAULT '',
  "ipfs" varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_as_cs NOT NULL DEFAULT '',
  "author" varchar(100) COLLATE utf8mb4_0900_as_cs NOT NULL,
  "created" int NOT NULL,
  "space" varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_as_cs NOT NULL,
  "network" varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_as_cs NOT NULL,
  "symbol" varchar(16) COLLATE utf8mb4_0900_as_cs NOT NULL DEFAULT '',
  "type" varchar(24) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_as_cs NOT NULL DEFAULT '',
  "strategies" json NOT NULL,
  "validation" json NOT NULL,
  "plugins" json NOT NULL,
  "title" text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_as_cs NOT NULL,
  "body" mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_as_cs NOT NULL,
  "discussion" text COLLATE utf8mb4_0900_as_cs NOT NULL,
  "choices" json NOT NULL,
  "labels" json DEFAULT NULL,
  "start" int NOT NULL,
  "end" int NOT NULL,
  "quorum" decimal(64,30) NOT NULL,
  "quorum_type" varchar(24) COLLATE utf8mb4_0900_as_cs DEFAULT '',
  "privacy" varchar(24) COLLATE utf8mb4_0900_as_cs NOT NULL,
  "snapshot" int NOT NULL,
  "app" varchar(24) COLLATE utf8mb4_0900_as_cs NOT NULL,
  "scores" json NOT NULL,
  "scores_by_strategy" json NOT NULL,
  "scores_state" varchar(24) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_as_cs NOT NULL DEFAULT '',
  "scores_total" decimal(64,30) NOT NULL,
  "scores_updated" int NOT NULL,
  "scores_total_value" decimal(64,30) NOT NULL DEFAULT '0.000000000000000000000000000000',
  "vp_value_by_strategy" json NOT NULL,
  "votes" int NOT NULL,
  "updated" int DEFAULT NULL,
  "flagged" int NOT NULL DEFAULT '0',
  "cb" int NOT NULL DEFAULT '0',
  PRIMARY KEY ("id"),
  KEY "author" ("author"),
  KEY "created" ("created"),
  KEY "network" ("network"),
  KEY "space" ("space"),
  KEY "start" ("start"),
  KEY "end" ("end"),
  KEY "ipfs" ("ipfs"),
  KEY "scores_state" ("scores_state"),
  KEY "scores_updated" ("scores_updated"),
  KEY "votes" ("votes"),
  KEY "app" ("app"),
  KEY "updated" ("updated"),
  KEY "flagged" ("flagged"),
  KEY "cb" ("cb")
);

The default value are from the table

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm correct 😢 werid, i don't understand why we need a default, maybe production has a outdated schema 🥲

votes INT(12) NOT NULL,
flagged INT NOT NULL DEFAULT 0,
cb INT NOT NULL DEFAULT 0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix: update schema.sql to reflect new columns
3 participants