Relocate model and schema to the db module
This commit is contained in:
parent
d7e5dd7df4
commit
7681079cb1
@ -4,6 +4,9 @@ use diesel::{Connection, PgConnection};
|
|||||||
use diesel::pg::Pg;
|
use diesel::pg::Pg;
|
||||||
use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness};
|
use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness};
|
||||||
|
|
||||||
|
pub mod models;
|
||||||
|
pub mod schema;
|
||||||
|
|
||||||
pub const MIGRATIONS: EmbeddedMigrations = embed_migrations!("./migrations");
|
pub const MIGRATIONS: EmbeddedMigrations = embed_migrations!("./migrations");
|
||||||
|
|
||||||
pub fn establish_connection() -> Result<PgConnection, Box<dyn error::Error>> {
|
pub fn establish_connection() -> Result<PgConnection, Box<dyn error::Error>> {
|
||||||
|
@ -6,7 +6,7 @@ use diesel::prelude::*;
|
|||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
#[derive(Queryable, Selectable)]
|
#[derive(Queryable, Selectable)]
|
||||||
#[diesel(table_name = crate::schema::tasks)]
|
#[diesel(table_name = crate::db::schema::tasks)]
|
||||||
#[diesel(check_for_backend(diesel::pg::Pg))]
|
#[diesel(check_for_backend(diesel::pg::Pg))]
|
||||||
pub struct Task {
|
pub struct Task {
|
||||||
pub id: Uuid,
|
pub id: Uuid,
|
@ -6,8 +6,6 @@ use std::{env, io};
|
|||||||
use actix_web::{App, get, HttpResponse, HttpServer, Responder};
|
use actix_web::{App, get, HttpResponse, HttpServer, Responder};
|
||||||
|
|
||||||
pub mod db;
|
pub mod db;
|
||||||
pub mod models;
|
|
||||||
pub mod schema;
|
|
||||||
pub mod util;
|
pub mod util;
|
||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user