Skip to content

Commit

Permalink
fix: update schema.sql to reflect production database (#970)
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e authored Jan 14, 2025
1 parent 4d00a77 commit 5508e77
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/helpers/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ CREATE TABLE spaces (
INDEX updated (updated)
);

-- Note: The `proposals` table schema might have some discrepancies
-- compared to the production database. This is due to legacy reasons
-- and the challenges associated with updating the schema because of its size.
-- `id` and `ipfs` columns should not have any default values.
CREATE TABLE proposals (
id VARCHAR(66) NOT NULL,
ipfs VARCHAR(64) NOT NULL,
Expand All @@ -36,8 +40,8 @@ CREATE TABLE proposals (
updated INT(11) DEFAULT NULL,
space VARCHAR(64) NOT NULL,
network VARCHAR(12) NOT NULL,
symbol VARCHAR(16) NOT NULL,
type VARCHAR(24) NOT NULL,
symbol VARCHAR(16) NOT NULL DEFAULT '',
type VARCHAR(24) NOT NULL DEFAULT '',
strategies JSON NOT NULL,
validation JSON NOT NULL,
plugins JSON NOT NULL,
Expand All @@ -49,19 +53,20 @@ CREATE TABLE proposals (
start INT(11) NOT NULL,
end INT(11) NOT NULL,
quorum DECIMAL(64,30) NOT NULL,
quorum_type VARCHAR(24) NOT NULL DEFAULT '',
quorum_type VARCHAR(24) DEFAULT '',
privacy VARCHAR(24) NOT NULL,
snapshot INT(24) NOT NULL,
app VARCHAR(24) NOT NULL,
scores JSON NOT NULL,
scores_by_strategy JSON NOT NULL,
scores_state VARCHAR(24) NOT NULL,
scores_state VARCHAR(24) NOT NULL DEFAULT '',
scores_total DECIMAL(64,30) NOT NULL,
scores_total_value DECIMAL(64,30) NOT NULL DEFAULT 0,
scores_updated INT(11) NOT NULL,
vp_value_by_strategy JSON NOT NULL,
scores_total_value DECIMAL(64,30) NOT NULL DEFAULT '0.000000000000000000000000000000',
vp_value_by_strategy json NOT NULL,
votes INT(12) NOT NULL,
flagged INT NOT NULL DEFAULT 0,
cb INT NOT NULL DEFAULT 0,
PRIMARY KEY (id),
INDEX ipfs (ipfs),
INDEX author (author),
Expand All @@ -75,7 +80,8 @@ CREATE TABLE proposals (
INDEX scores_state (scores_state),
INDEX scores_updated (scores_updated),
INDEX votes (votes),
INDEX flagged (flagged)
INDEX flagged (flagged),
INDEX cb (cb)
);

CREATE TABLE votes (
Expand Down

0 comments on commit 5508e77

Please sign in to comment.