-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
...ungandr-scenario-tests/resources/vit_station/migration/2020-05-22-112032_initial/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- This file should undo anything in `up.sql` | ||
DROP TABLE IF EXISTS proposals; | ||
DROP TABLE IF EXISTS funds; | ||
DROP TABLE IF EXISTS voteplans; | ||
DROP TABLE IF EXISTS api_tokens; | ||
DROP VIEW IF EXISTS full_proposals_info; | ||
|
73 changes: 73 additions & 0 deletions
73
...rmungandr-scenario-tests/resources/vit_station/migration/2020-05-22-112032_initial/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
create table funds | ||
( | ||
id INTEGER NOT NULL | ||
primary key autoincrement, | ||
fund_name VARCHAR NOT NULL, | ||
fund_goal VARCHAR NOT NULL, | ||
voting_power_info VARCHAR NOT NULL, | ||
voting_power_threshold BIGINT NOT NULL, | ||
rewards_info VARCHAR NOT NULL, | ||
fund_start_time BIGINT NOT NULL, | ||
fund_end_time BIGINT NOT NULL, | ||
next_fund_start_time BIGINT NOT NULL | ||
); | ||
|
||
create table proposals | ||
( | ||
id INTEGER NOT NULL | ||
primary key autoincrement, | ||
proposal_id VARCHAR NOT NULL, | ||
proposal_category VARCHAR NOT NULL, | ||
proposal_title VARCHAR NOT NULL, | ||
proposal_summary VARCHAR NOT NULL, | ||
proposal_problem VARCHAR NOT NULL, | ||
proposal_solution VARCHAR NOT NULL, | ||
proposal_public_key VARCHAR NOT NULL, | ||
proposal_funds BIGINT NOT NULL, | ||
proposal_url VARCHAR NOT NULL, | ||
proposal_files_url VARCHAR NOT NULL, | ||
proposal_impact_score BIGINT NOT NULL, | ||
proposer_name VARCHAR NOT NULL, | ||
proposer_contact VARCHAR NOT NULL, | ||
proposer_url VARCHAR NOT NULL, | ||
proposer_relevant_experience VARCHAR NOT NULL, | ||
chain_proposal_id BLOB NOT NULL, | ||
chain_proposal_index BIGINT NOT NULL, | ||
chain_vote_options VARCHAR NOT NULL, | ||
chain_voteplan_id VARCHAR NOT NULL | ||
); | ||
|
||
create table voteplans | ||
( | ||
id INTEGER NOT NULL | ||
primary key autoincrement, | ||
chain_voteplan_id VARCHAR NOT NULL | ||
unique, | ||
chain_vote_start_time BIGINT NOT NULL, | ||
chain_vote_end_time BIGINT NOT NULL, | ||
chain_committee_end_time BIGINT NOT NULL, | ||
chain_voteplan_payload VARCHAR NOT NULL, | ||
fund_id INTEGER NOT NULL | ||
); | ||
|
||
create table api_tokens | ||
( | ||
token BLOB NOT NULL UNIQUE PRIMARY KEY , | ||
creation_time BIGINT NOT NULL, | ||
expire_time BIGINT NOT NULL | ||
); | ||
|
||
|
||
CREATE VIEW full_proposals_info | ||
AS | ||
SELECT | ||
proposals.*, | ||
voteplans.chain_voteplan_payload, | ||
voteplans.chain_vote_start_time, | ||
voteplans.chain_vote_end_time, | ||
voteplans.chain_committee_end_time, | ||
voteplans.fund_id | ||
FROM | ||
proposals | ||
INNER JOIN voteplans ON proposals.chain_voteplan_id = voteplans.chain_voteplan_id | ||
|