avatar
This commit is contained in:
@@ -49,6 +49,7 @@ mod m20260623_000001_add_short_description_to_products;
|
||||
mod m20260623_000002_strip_html_from_product_search;
|
||||
mod m20260623_000003_drop_currency;
|
||||
mod m20260623_000004_currencies;
|
||||
mod m20260625_000001_add_avatar_to_users;
|
||||
pub struct Migrator;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
@@ -102,6 +103,7 @@ impl MigratorTrait for Migrator {
|
||||
Box::new(m20260623_000002_strip_html_from_product_search::Migration),
|
||||
Box::new(m20260623_000003_drop_currency::Migration),
|
||||
Box::new(m20260623_000004_currencies::Migration),
|
||||
Box::new(m20260625_000001_add_avatar_to_users::Migration),
|
||||
// inject-above (do not remove this comment)
|
||||
]
|
||||
}
|
||||
|
||||
20
migration/src/m20260625_000001_add_avatar_to_users.rs
Normal file
20
migration/src/m20260625_000001_add_avatar_to_users.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use loco_rs::schema::*;
|
||||
use sea_orm_migration::prelude::*;
|
||||
|
||||
#[derive(DeriveMigrationName)]
|
||||
pub struct Migration;
|
||||
|
||||
// Optional profile avatar. `avatar_id` holds the stored image's filename (the
|
||||
// same `<uuid>.<ext>` scheme as product/category images), served through the
|
||||
// shared `/images/{filename}` route. NULL = no avatar, fall back to initials.
|
||||
#[async_trait::async_trait]
|
||||
impl MigrationTrait for Migration {
|
||||
async fn up(&self, m: &SchemaManager) -> Result<(), DbErr> {
|
||||
add_column(m, "users", "avatar_id", ColType::StringNull).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn down(&self, m: &SchemaManager) -> Result<(), DbErr> {
|
||||
remove_column(m, "users", "avatar_id").await
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user