Skip to content

Commit f5f3d85

Browse files
committed
Don't rely on a database connection at compile time
This isn't strictly necessary, but inferring the `crates` table requires a feature that Diesel won't have until 0.12, and this has the fewest unanswered questions.
1 parent 034ed98 commit f5f3d85

File tree

4 files changed

+220
-4
lines changed

4 files changed

+220
-4
lines changed

Cargo.lock

+47
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ rustc-serialize = "0.3"
3636
license-exprs = "^1.3"
3737
dotenv = "0.8.0"
3838
toml = "0.2"
39-
diesel = { version = "0.11.0", features = ["postgres"] }
39+
diesel = { version = "0.11.0", features = ["postgres", "serde_json"] }
4040
diesel_codegen = { version = "0.11.0", features = ["postgres"] }
4141
r2d2-diesel = "0.11.0"
42+
diesel_full_text_search = "0.11.0"
4243

4344
conduit = "0.8"
4445
conduit-conditional-get = "0.8"

src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
extern crate postgres as pg;
1111
extern crate rustc_serialize;
1212
extern crate curl;
13+
extern crate diesel_full_text_search;
1314
extern crate dotenv;
1415
extern crate flate2;
1516
extern crate git2;

src/schema.rs

+170-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,171 @@
1-
mod infer_users {
2-
infer_table_from_schema!("dotenv:DATABASE_URL", "users");
1+
// This file can be regenerated with `diesel print-schema`
2+
3+
table! {
4+
badges (crate_id,
5+
badge_type) {
6+
crate_id -> Int4,
7+
badge_type -> Varchar,
8+
attributes -> Jsonb,
9+
}
10+
}
11+
12+
table! {
13+
categories (id) {
14+
id -> Int4,
15+
category -> Varchar,
16+
slug -> Varchar,
17+
description -> Varchar,
18+
crates_cnt -> Int4,
19+
created_at -> Timestamp,
20+
}
21+
}
22+
23+
table! {
24+
crate_downloads (id) {
25+
id -> Int4,
26+
crate_id -> Int4,
27+
downloads -> Int4,
28+
date -> Timestamp,
29+
}
30+
}
31+
32+
table! {
33+
crate_owners (id) {
34+
id -> Int4,
35+
crate_id -> Int4,
36+
owner_id -> Int4,
37+
created_at -> Timestamp,
38+
created_by -> Nullable<Int4>,
39+
deleted -> Bool,
40+
updated_at -> Timestamp,
41+
owner_kind -> Int4,
42+
}
43+
}
44+
45+
table! {
46+
crates (id) {
47+
id -> Int4,
48+
name -> Varchar,
49+
updated_at -> Timestamp,
50+
created_at -> Timestamp,
51+
downloads -> Int4,
52+
max_version -> Nullable<Varchar>,
53+
description -> Nullable<Varchar>,
54+
homepage -> Nullable<Varchar>,
55+
documentation -> Nullable<Varchar>,
56+
readme -> Nullable<Varchar>,
57+
textsearchable_index_col -> Nullable<::diesel_full_text_search::TsVector>,
58+
license -> Nullable<Varchar>,
59+
repository -> Nullable<Varchar>,
60+
max_upload_size -> Nullable<Int4>,
61+
}
62+
}
63+
64+
table! {
65+
crates_categories (crate_id,
66+
category_id) {
67+
crate_id -> Int4,
68+
category_id -> Int4,
69+
}
70+
}
71+
72+
table! {
73+
crates_keywords (crate_id,
74+
keyword_id) {
75+
crate_id -> Int4,
76+
keyword_id -> Int4,
77+
}
78+
}
79+
80+
table! {
81+
dependencies (id) {
82+
id -> Int4,
83+
version_id -> Int4,
84+
crate_id -> Int4,
85+
req -> Varchar,
86+
optional -> Bool,
87+
default_features -> Bool,
88+
features -> Varchar,
89+
target -> Nullable<Varchar>,
90+
kind -> Nullable<Int4>,
91+
}
92+
}
93+
94+
table! {
95+
follows (user_id,
96+
crate_id) {
97+
user_id -> Int4,
98+
crate_id -> Int4,
99+
}
100+
}
101+
102+
table! {
103+
keywords (id) {
104+
id -> Int4,
105+
keyword -> Varchar,
106+
crates_cnt -> Int4,
107+
created_at -> Timestamp,
108+
}
109+
}
110+
111+
table! {
112+
metadata (total_downloads) {
113+
total_downloads -> Int8,
114+
}
115+
}
116+
117+
table! {
118+
teams (id) {
119+
id -> Int4,
120+
login -> Varchar,
121+
github_id -> Int4,
122+
name -> Nullable<Varchar>,
123+
avatar -> Nullable<Varchar>,
124+
}
125+
}
126+
127+
table! {
128+
users (id) {
129+
id -> Int4,
130+
email -> Nullable<Varchar>,
131+
gh_access_token -> Varchar,
132+
api_token -> Varchar,
133+
gh_login -> Varchar,
134+
name -> Nullable<Varchar>,
135+
gh_avatar -> Nullable<Varchar>,
136+
gh_id -> Int4,
137+
}
138+
}
139+
140+
table! {
141+
version_authors (id) {
142+
id -> Int4,
143+
version_id -> Int4,
144+
user_id -> Nullable<Int4>,
145+
name -> Varchar,
146+
}
147+
}
148+
149+
table! {
150+
version_downloads (id) {
151+
id -> Int4,
152+
version_id -> Int4,
153+
downloads -> Int4,
154+
counted -> Int4,
155+
date -> Timestamp,
156+
processed -> Bool,
157+
}
158+
}
159+
160+
table! {
161+
versions (id) {
162+
id -> Int4,
163+
crate_id -> Int4,
164+
num -> Varchar,
165+
updated_at -> Timestamp,
166+
created_at -> Timestamp,
167+
downloads -> Int4,
168+
features -> Nullable<Varchar>,
169+
yanked -> Nullable<Bool>,
170+
}
3171
}
4-
pub use self::infer_users::*;

0 commit comments

Comments
 (0)