Skip to content

Commit

Permalink
fix wrong assignment of fields
Browse files Browse the repository at this point in the history
  • Loading branch information
pansen committed Aug 21, 2016
1 parent 29658e6 commit e52e3e5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,26 @@ use super::schema::track;


/// Channel struct for found tracks
///
/// TODO amb: *attention* the field names in the db-creation must match the given order here
/// #[column_name(something)] will not work
#[derive(Queryable)]
pub struct Track {
/// hash of the parsed file
pub hash: String,
/// path of that file
pub path: String,
/// id3 title
pub title: String,
/// id3 album
pub album: String,
/// hash of the parsed file
pub hash: String
}


#[insertable_into(track)]
pub struct NewTrack<'a> {
pub hash: &'a str,
pub path: &'a str,
pub title: &'a str,
pub album: &'a str,
pub hash: &'a str,
}
4 changes: 4 additions & 0 deletions src/schema.rs
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
infer_schema!(dotenv!("DATABASE_URL"));


// or, to be more explicit:
// infer_table_from_schema!(dotenv!("DATABASE_URL"), "track");

0 comments on commit e52e3e5

Please sign in to comment.