Data upload from web

This commit is contained in:
2024-11-03 02:46:38 +01:00
parent 5c69317660
commit 1bb774eb00
16 changed files with 150 additions and 75 deletions

View File

@@ -8,7 +8,6 @@ mod m20241029_235230_skills;
mod m20241030_002154_jobs;
mod m20241030_024340_projects;
mod m20241030_024830_data;
mod m20241102_204505_add_file_name_to_data;
pub struct Migrator;
#[async_trait::async_trait]
@@ -16,7 +15,6 @@ impl MigratorTrait for Migrator {
fn migrations() -> Vec<Box<dyn MigrationTrait>> {
vec![
// inject-below
Box::new(m20241102_204505_add_file_name_to_data::Migration),
Box::new(m20241030_024830_data::Migration),
Box::new(m20241030_024340_projects::Migration),
Box::new(m20241030_002154_jobs::Migration),
@@ -24,4 +22,4 @@ impl MigratorTrait for Migrator {
Box::new(m20220101_000001_users::Migration),
]
}
}
}

View File

@@ -13,6 +13,7 @@ impl MigrationTrait for Migration {
.col(pk_auto(Data::Id))
.col(string(Data::FileUrl))
.col(boolean(Data::Protected))
.col(string(Data::FileName))
.to_owned(),
)
.await
@@ -31,7 +32,5 @@ enum Data {
Id,
FileUrl,
Protected,
FileName,
}

View File

@@ -1,35 +0,0 @@
use sea_orm_migration::{prelude::*, schema::*};
#[derive(DeriveMigrationName)]
pub struct Migration;
#[derive(DeriveIden)]
enum Data {
Table,
FileName,
}
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.alter_table(
Table::alter()
.table(Data::Table)
.add_column_if_not_exists(string(Data::FileName))
.to_owned(),
)
.await
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.alter_table(
Table::alter()
.table(Data::Table)
.drop_column(Data::FileName)
.to_owned(),
)
.await
}
}