-
Notifications
You must be signed in to change notification settings - Fork 15
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
base: master
Are you sure you want to change the base?
Conversation
Any updates on this one ? Some tests are failing without this |
As far as I remember @bonustrack asked us to wait, but I'm not sure exactly. Do you think we can proceed? @bonustrack |
Codecov ReportAll modified and coverable lines are covered by tests ✅ Additional details and impacted files📢 Thoughts on this report? Let us know! |
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 '', |
There was a problem hiding this comment.
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? 😅
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 🥲
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which way we go?
votes INT(12) NOT NULL, | ||
flagged INT NOT NULL DEFAULT 0, | ||
cb INT NOT NULL DEFAULT 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No cb on We should add same on https://github.com/snapshot-labs/snapshot-hub/blob/master/src/helpers/schema.sql 🤔 new field?
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 defaultAdded missing INDEX