Quit using diesel_infer_schema.

Instead, let diesel keep src/schema.rs up-to-date when migrating.
This commit is contained in:
Rasmus Kaj 2018-08-31 22:40:39 +02:00
parent e5e1ff0234
commit 1d862962b6
4 changed files with 123 additions and 4 deletions

View File

@ -23,7 +23,6 @@ image = "^0.19.0"
time = "*"
kamadak-exif = "~0.3.0"
diesel = { version = "~1.2.2", features = ["chrono", "postgres"] }
diesel_infer_schema = { version = "~1.2.0", features = ["postgres"] }
r2d2-diesel = "^1.0.0"
r2d2 = "^0.8.2" # Must match version used by r2d2-diesel
rustc-serialize = "0.3.24" # Must match version used by nickel

5
diesel.toml Normal file
View File

@ -0,0 +1,5 @@
# For documentation on how to configure this file,
# see diesel.rs/guides/configuring-diesel-cli
[print_schema]
file = "src/schema.rs"

View File

@ -4,8 +4,6 @@ extern crate chrono;
extern crate clap;
#[macro_use]
extern crate diesel;
#[macro_use]
extern crate diesel_infer_schema;
extern crate djangohashers;
extern crate dotenv;
extern crate env_logger;

View File

@ -1 +1,118 @@
infer_schema!("dotenv:DATABASE_URL");
table! {
attributions (id) {
id -> Int4,
name -> Varchar,
}
}
table! {
cameras (id) {
id -> Int4,
manufacturer -> Varchar,
model -> Varchar,
}
}
table! {
people (id) {
id -> Int4,
slug -> Varchar,
person_name -> Varchar,
}
}
table! {
photo_people (id) {
id -> Int4,
photo_id -> Int4,
person_id -> Int4,
}
}
table! {
photo_places (id) {
id -> Int4,
photo_id -> Int4,
place_id -> Int4,
}
}
table! {
photos (id) {
id -> Int4,
path -> Varchar,
date -> Nullable<Timestamp>,
grade -> Nullable<Int2>,
rotation -> Int2,
is_public -> Bool,
camera_id -> Nullable<Int4>,
attribution_id -> Nullable<Int4>,
width -> Nullable<Int4>,
height -> Nullable<Int4>,
}
}
table! {
photo_tags (id) {
id -> Int4,
photo_id -> Int4,
tag_id -> Int4,
}
}
table! {
places (id) {
id -> Int4,
slug -> Varchar,
place_name -> Varchar,
}
}
table! {
positions (id) {
id -> Int4,
photo_id -> Int4,
latitude -> Int4,
longitude -> Int4,
}
}
table! {
tags (id) {
id -> Int4,
slug -> Varchar,
tag_name -> Varchar,
}
}
table! {
users (id) {
id -> Int4,
username -> Varchar,
password -> Varchar,
}
}
joinable!(photo_people -> people (person_id));
joinable!(photo_people -> photos (photo_id));
joinable!(photo_places -> photos (photo_id));
joinable!(photo_places -> places (place_id));
joinable!(photo_tags -> photos (photo_id));
joinable!(photo_tags -> tags (tag_id));
joinable!(photos -> attributions (attribution_id));
joinable!(photos -> cameras (camera_id));
joinable!(positions -> photos (photo_id));
allow_tables_to_appear_in_same_query!(
attributions,
cameras,
people,
photo_people,
photo_places,
photos,
photo_tags,
places,
positions,
tags,
users,
);