feat: ship public ops features and cache docker builds
Some checks failed
docker-images / build-and-push (admin, admin, termi-astro-admin, admin/Dockerfile) (push) Failing after 13s
docker-images / build-and-push (frontend, frontend, termi-astro-frontend, frontend/Dockerfile) (push) Has been cancelled
docker-images / build-and-push (backend, backend, termi-astro-backend, backend/Dockerfile) (push) Has been cancelled

This commit is contained in:
2026-04-01 13:22:19 +08:00
parent 669b79cc95
commit 497a9d713d
75 changed files with 6985 additions and 668 deletions

View File

@@ -37,6 +37,10 @@ mod m20260331_000026_create_subscriptions;
mod m20260331_000027_create_notification_deliveries;
mod m20260331_000028_expand_subscriptions_and_deliveries;
mod m20260331_000029_add_subscription_popup_settings_to_site_settings;
mod m20260401_000030_add_public_security_and_web_push_to_site_settings;
mod m20260401_000031_add_notification_channel_type_to_site_settings;
mod m20260401_000032_add_runtime_security_keys_to_site_settings;
mod m20260401_000033_add_taxonomy_metadata_and_media_assets;
pub struct Migrator;
#[async_trait::async_trait]
@@ -78,6 +82,10 @@ impl MigratorTrait for Migrator {
Box::new(m20260331_000027_create_notification_deliveries::Migration),
Box::new(m20260331_000028_expand_subscriptions_and_deliveries::Migration),
Box::new(m20260331_000029_add_subscription_popup_settings_to_site_settings::Migration),
Box::new(m20260401_000030_add_public_security_and_web_push_to_site_settings::Migration),
Box::new(m20260401_000031_add_notification_channel_type_to_site_settings::Migration),
Box::new(m20260401_000032_add_runtime_security_keys_to_site_settings::Migration),
Box::new(m20260401_000033_add_taxonomy_metadata_and_media_assets::Migration),
// inject-above (do not remove this comment)
]
}

View File

@@ -0,0 +1,59 @@
use sea_orm_migration::prelude::*;
#[derive(DeriveMigrationName)]
pub struct Migration;
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
let table = Alias::new("site_settings");
manager
.alter_table(
Table::alter()
.table(table.clone())
.add_column_if_not_exists(
ColumnDef::new(Alias::new("comment_turnstile_enabled"))
.boolean()
.null(),
)
.add_column_if_not_exists(
ColumnDef::new(Alias::new("subscription_turnstile_enabled"))
.boolean()
.null(),
)
.add_column_if_not_exists(
ColumnDef::new(Alias::new("web_push_enabled"))
.boolean()
.null(),
)
.to_owned(),
)
.await?;
Ok(())
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
let table = Alias::new("site_settings");
for column in [
"web_push_enabled",
"subscription_turnstile_enabled",
"comment_turnstile_enabled",
] {
if manager.has_column("site_settings", column).await? {
manager
.alter_table(
Table::alter()
.table(table.clone())
.drop_column(Alias::new(column))
.to_owned(),
)
.await?;
}
}
Ok(())
}
}

View File

@@ -0,0 +1,51 @@
use sea_orm_migration::prelude::*;
#[derive(DeriveMigrationName)]
pub struct Migration;
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
let table = Alias::new("site_settings");
if !manager
.has_column("site_settings", "notification_channel_type")
.await?
{
manager
.alter_table(
Table::alter()
.table(table.clone())
.add_column(
ColumnDef::new(Alias::new("notification_channel_type"))
.string()
.null(),
)
.to_owned(),
)
.await?;
}
Ok(())
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
let table = Alias::new("site_settings");
if manager
.has_column("site_settings", "notification_channel_type")
.await?
{
manager
.alter_table(
Table::alter()
.table(table)
.drop_column(Alias::new("notification_channel_type"))
.to_owned(),
)
.await?;
}
Ok(())
}
}

View File

@@ -0,0 +1,71 @@
use sea_orm_migration::prelude::*;
#[derive(DeriveMigrationName)]
pub struct Migration;
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
let table = Alias::new("site_settings");
manager
.alter_table(
Table::alter()
.table(table)
.add_column_if_not_exists(
ColumnDef::new(Alias::new("turnstile_site_key"))
.text()
.null(),
)
.add_column_if_not_exists(
ColumnDef::new(Alias::new("turnstile_secret_key"))
.text()
.null(),
)
.add_column_if_not_exists(
ColumnDef::new(Alias::new("web_push_vapid_public_key"))
.text()
.null(),
)
.add_column_if_not_exists(
ColumnDef::new(Alias::new("web_push_vapid_private_key"))
.text()
.null(),
)
.add_column_if_not_exists(
ColumnDef::new(Alias::new("web_push_vapid_subject"))
.text()
.null(),
)
.to_owned(),
)
.await?;
Ok(())
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
let table = Alias::new("site_settings");
for column in [
"web_push_vapid_subject",
"web_push_vapid_private_key",
"web_push_vapid_public_key",
"turnstile_secret_key",
"turnstile_site_key",
] {
if manager.has_column("site_settings", column).await? {
manager
.alter_table(
Table::alter()
.table(table.clone())
.drop_column(Alias::new(column))
.to_owned(),
)
.await?;
}
}
Ok(())
}
}

View File

@@ -0,0 +1,161 @@
use sea_orm_migration::prelude::*;
#[derive(DeriveMigrationName)]
pub struct Migration;
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
for table_name in ["categories", "tags"] {
if !manager.has_column(table_name, "description").await? {
manager
.alter_table(
Table::alter()
.table(Alias::new(table_name))
.add_column(ColumnDef::new(Alias::new("description")).text().null())
.to_owned(),
)
.await?;
}
if !manager.has_column(table_name, "cover_image").await? {
manager
.alter_table(
Table::alter()
.table(Alias::new(table_name))
.add_column(ColumnDef::new(Alias::new("cover_image")).string().null())
.to_owned(),
)
.await?;
}
if !manager.has_column(table_name, "accent_color").await? {
manager
.alter_table(
Table::alter()
.table(Alias::new(table_name))
.add_column(ColumnDef::new(Alias::new("accent_color")).string().null())
.to_owned(),
)
.await?;
}
if !manager.has_column(table_name, "seo_title").await? {
manager
.alter_table(
Table::alter()
.table(Alias::new(table_name))
.add_column(ColumnDef::new(Alias::new("seo_title")).string().null())
.to_owned(),
)
.await?;
}
if !manager.has_column(table_name, "seo_description").await? {
manager
.alter_table(
Table::alter()
.table(Alias::new(table_name))
.add_column(ColumnDef::new(Alias::new("seo_description")).text().null())
.to_owned(),
)
.await?;
}
}
if !manager.has_table("media_assets").await? {
manager
.create_table(
Table::create()
.table(Alias::new("media_assets"))
.if_not_exists()
.col(
ColumnDef::new(Alias::new("created_at"))
.timestamp_with_time_zone()
.not_null()
.default(Expr::current_timestamp()),
)
.col(
ColumnDef::new(Alias::new("updated_at"))
.timestamp_with_time_zone()
.not_null()
.default(Expr::current_timestamp()),
)
.col(
ColumnDef::new(Alias::new("id"))
.integer()
.not_null()
.auto_increment()
.primary_key(),
)
.col(ColumnDef::new(Alias::new("object_key")).string().not_null())
.col(ColumnDef::new(Alias::new("title")).string().null())
.col(ColumnDef::new(Alias::new("alt_text")).string().null())
.col(ColumnDef::new(Alias::new("caption")).text().null())
.col(ColumnDef::new(Alias::new("tags")).json_binary().null())
.col(ColumnDef::new(Alias::new("notes")).text().null())
.to_owned(),
)
.await?;
}
manager
.create_index(
Index::create()
.name("idx_media_assets_object_key_unique")
.table(Alias::new("media_assets"))
.col(Alias::new("object_key"))
.unique()
.if_not_exists()
.to_owned(),
)
.await?;
Ok(())
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
if manager
.has_index("media_assets", "idx_media_assets_object_key_unique")
.await?
{
manager
.drop_index(
Index::drop()
.name("idx_media_assets_object_key_unique")
.table(Alias::new("media_assets"))
.to_owned(),
)
.await?;
}
if manager.has_table("media_assets").await? {
manager
.drop_table(Table::drop().table(Alias::new("media_assets")).to_owned())
.await?;
}
for table_name in ["categories", "tags"] {
for column in [
"seo_description",
"seo_title",
"accent_color",
"cover_image",
"description",
] {
if manager.has_column(table_name, column).await? {
manager
.alter_table(
Table::alter()
.table(Alias::new(table_name))
.drop_column(Alias::new(column))
.to_owned(),
)
.await?;
}
}
}
Ok(())
}
}