Skip to content

Commit

Permalink
add ContextType field to context table/model
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-codecov committed Jan 12, 2024
1 parent d2a9ba1 commit 0bb4105
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions migrations/2024-01-09-033635_init/up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ CREATE TABLE context_assoc (

CREATE TABLE context (
id INTEGER PRIMARY KEY,
context_type VARCHAR NOT NULL,
name VARCHAR NOT NULL
);
1 change: 1 addition & 0 deletions src/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ mod tests {

let mock_context = models::Context {
id: 0,
context_type: schema::ContextType::TestCase,
name: "mock_context".to_string(),
};
diesel::insert_into(schema::context::table)
Expand Down
1 change: 1 addition & 0 deletions src/report/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ pub struct ContextAssoc {
#[diesel(table_name = context)]
pub struct Context {
pub id: i32,
pub context_type: ContextType,
pub name: String,
}
8 changes: 8 additions & 0 deletions src/report/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ pub enum CoverageStatus {
Partial,
}

#[derive(diesel_derive_enum::DbEnum, Debug, PartialEq)]
pub enum ContextType {
TestCase,
Upload,
}

diesel::table! {
use diesel::sql_types::{VarChar, Integer};
source_file (id) {
Expand Down Expand Up @@ -49,8 +55,10 @@ diesel::table! {

diesel::table! {
use diesel::sql_types::{VarChar, Integer};
use super::ContextTypeMapping;
context (id) {
id -> Integer,
context_type -> ContextTypeMapping,
name -> VarChar,
}
}
Expand Down

0 comments on commit 0bb4105

Please sign in to comment.