diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-25 18:43:38 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-25 18:43:38 -0700 |
commit | 79807ca16c98c5f75e08624a514ba2afe585373a (patch) | |
tree | ae92957724d3d0cd56a4d0d31188603111cf635c | |
parent | f8d9d4f92bcb491d54360e335745056be0de19e2 (diff) | |
download | fatcat-79807ca16c98c5f75e08624a514ba2afe585373a.tar.gz fatcat-79807ca16c98c5f75e08624a514ba2afe585373a.zip |
index for contribs
-rw-r--r-- | rust/migrations/2018-05-12-001226_init/up.sql | 11 | ||||
-rw-r--r-- | rust/src/api_server.rs | 11 | ||||
-rw-r--r-- | rust/src/database_models.rs | 4 | ||||
-rw-r--r-- | rust/src/database_schema.rs | 3 |
4 files changed, 14 insertions, 15 deletions
diff --git a/rust/migrations/2018-05-12-001226_init/up.sql b/rust/migrations/2018-05-12-001226_init/up.sql index 41df87ea..1fbd7c09 100644 --- a/rust/migrations/2018-05-12-001226_init/up.sql +++ b/rust/migrations/2018-05-12-001226_init/up.sql @@ -187,8 +187,9 @@ CREATE TABLE release_contrib ( id BIGSERIAL PRIMARY KEY, release_rev BIGSERIAL REFERENCES release_rev(id) NOT NULL, creator_ident_id UUID REFERENCES creator_ident(id), - stub TEXT, - contrib_type TEXT + contrib_type TEXT, + index BIGINT, + stub TEXT ); CREATE TABLE release_ref ( @@ -301,9 +302,9 @@ INSERT INTO release_edit (ident_id, rev_id, redirect_id, editgroup_id) VALUES ('f1f046a3-45c9-4b99-4444-000000000001', 1, null, 4), ('f1f046a3-45c9-4b99-4444-000000000002', 2, null, 5); -INSERT INTO release_contrib (release_rev, creator_ident_id, stub, contrib_type) VALUES - (2, null, null, null), - (2, 'f1f046a3-45c9-4b99-adce-000000000002', 'some contrib', 'editor'); +INSERT INTO release_contrib (release_rev, creator_ident_id, stub, contrib_type, index) VALUES + (2, null, null, null, null), + (2, 'f1f046a3-45c9-4b99-adce-000000000002', 'some contrib', 'editor', 4); INSERT INTO release_ref (release_rev, target_release_ident_id, index, stub) VALUES (2, null, null, null), diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs index 19cd5fe4..6fbce00b 100644 --- a/rust/src/api_server.rs +++ b/rust/src/api_server.rs @@ -332,8 +332,7 @@ impl Server { .expect("fetch release refs") .iter() .map(|c: &ReleaseContribRow| ReleaseContrib { - // XXX: index: c.index, - index: None, + index: c.index, contrib_type: c.contrib_type.clone(), creator_stub: c.stub.clone(), creator_id: c.creator_ident_id.map(|v| v.to_string()), @@ -396,8 +395,7 @@ impl Server { .expect("fetch release refs") .iter() .map(|c: &ReleaseContribRow| ReleaseContrib { - // XXX: index: c.index, - index: None, + index: c.index, contrib_type: c.contrib_type.clone(), creator_stub: c.stub.clone(), creator_id: c.creator_ident_id.map(|v| v.to_string()), @@ -781,8 +779,7 @@ impl Api for Server { target_release_ident_id: r.target_release_id .clone() .map(|v| uuid::Uuid::parse_str(&v).expect("valid UUID")), - // XXX: index: r.index, - index: None, + index: r.index, stub: r.stub.clone(), }) .collect(); @@ -808,7 +805,7 @@ impl Api for Server { creator_ident_id: c.creator_id .clone() .map(|v| uuid::Uuid::parse_str(&v).expect("valid UUID")), - // XXX: index: r.index, + index: c.index, contrib_type: c.contrib_type.clone(), stub: c.creator_stub.clone(), }) diff --git a/rust/src/database_models.rs b/rust/src/database_models.rs index 1b4841a0..2b205fe7 100644 --- a/rust/src/database_models.rs +++ b/rust/src/database_models.rs @@ -154,7 +154,7 @@ pub struct ReleaseContribRow { pub release_rev: i64, pub creator_ident_id: Option<Uuid>, pub stub: Option<String>, - // XXX: pub index: Option<i64>, + pub index: Option<i64>, pub contrib_type: Option<String>, } @@ -164,7 +164,7 @@ pub struct ReleaseContribNewRow { pub release_rev: i64, pub creator_ident_id: Option<Uuid>, pub stub: Option<String>, - // XXX: pub index: Option<i64>, + pub index: Option<i64>, pub contrib_type: Option<String>, } diff --git a/rust/src/database_schema.rs b/rust/src/database_schema.rs index fcbd809c..3adbd63a 100644 --- a/rust/src/database_schema.rs +++ b/rust/src/database_schema.rs @@ -125,8 +125,9 @@ table! { id -> Int8, release_rev -> Int8, creator_ident_id -> Nullable<Uuid>, - stub -> Nullable<Text>, contrib_type -> Nullable<Text>, + index -> Nullable<Int8>, + stub -> Nullable<Text>, } } |