mirror of
https://github.com/danbulant/Portfolio
synced 2026-05-20 04:48:32 +00:00
refactor: change ip address inet type to string
This commit is contained in:
parent
5e36b7b3c8
commit
98110dcf96
3 changed files with 2 additions and 20 deletions
|
|
@ -2,7 +2,7 @@ use chrono::Duration;
|
|||
use entity::candidate;
|
||||
use sea_orm::{DatabaseConnection, prelude::Uuid, ModelTrait};
|
||||
|
||||
use crate::{crypto::{self, hash_sha256}, Query, token::{generate_candidate_token, candidate_token::CandidateToken}, error::{ServiceError, USER_NOT_FOUND_ERROR, INVALID_CREDENTIALS_ERROR, DB_ERROR, USER_NOT_FOUND_BY_JWT_ID, USER_NOT_FOUND_BY_SESSION_ID}, Mutation};
|
||||
use crate::{crypto::{self}, Query, token::{generate_candidate_token, candidate_token::CandidateToken}, error::{ServiceError, USER_NOT_FOUND_ERROR, INVALID_CREDENTIALS_ERROR, DB_ERROR, USER_NOT_FOUND_BY_JWT_ID, USER_NOT_FOUND_BY_SESSION_ID}, Mutation};
|
||||
|
||||
pub struct CandidateService;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ pub struct Model {
|
|||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
pub user_id: i32,
|
||||
#[sea_orm(column_type = "Custom(\"inet\".to_owned())")]
|
||||
pub ip_address: String,
|
||||
pub created_at: DateTime,
|
||||
pub expires_at: DateTime,
|
||||
|
|
|
|||
|
|
@ -1,28 +1,11 @@
|
|||
use sea_orm_migration::prelude::*;
|
||||
|
||||
use crate::m20221024_121621_create_candidate::Candidate;
|
||||
|
||||
#[derive(DeriveMigrationName)]
|
||||
pub struct Migration;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl MigrationTrait for Migration {
|
||||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
let table = Table::create()
|
||||
.table(Session::Table)
|
||||
.if_not_exists()
|
||||
.col(
|
||||
ColumnDef::new(Session::Id)
|
||||
.uuid()
|
||||
.not_null()
|
||||
.unique_key()
|
||||
.primary_key(),
|
||||
)
|
||||
.col(ColumnDef::new(Session::UserId).integer().not_null())
|
||||
.col(ColumnDef::new(Session::CreatedAt).date_time().not_null())
|
||||
.col(ColumnDef::new(Session::ExpiresAt).date_time().not_null())
|
||||
.to_owned();
|
||||
|
||||
manager
|
||||
.create_table(
|
||||
Table::create()
|
||||
|
|
@ -36,7 +19,7 @@ impl MigrationTrait for Migration {
|
|||
.primary_key(),
|
||||
)
|
||||
.col(ColumnDef::new(Session::UserId).integer().not_null())
|
||||
.col(ColumnDef::new(Session::IpAddress).inet().not_null())
|
||||
.col(ColumnDef::new(Session::IpAddress).string().not_null())
|
||||
.col(ColumnDef::new(Session::CreatedAt).date_time().not_null())
|
||||
.col(ColumnDef::new(Session::ExpiresAt).date_time().not_null())
|
||||
.to_owned(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue