✨ (admin): Añade la extensión pagetop-admin
Panel de administración extensible: registro de secciones/páginas/ tareas/acciones vía acciones `Declare*`, formularios de configuración automáticos (ConfigForm + SettingsSchema) y persistencia en la tabla `settings`.
This commit is contained in:
parent
c0a5a8c3ab
commit
88acc08b5f
18 changed files with 1847 additions and 0 deletions
|
|
@ -0,0 +1,49 @@
|
|||
use pagetop_seaorm::migration::*;
|
||||
|
||||
/// Tabla `settings`: almacén clave-valor JSON para configuración persistente.
|
||||
pub struct Migration;
|
||||
|
||||
#[pagetop::async_trait]
|
||||
impl MigrationTrait for Migration {
|
||||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.create_table(
|
||||
Table::create()
|
||||
.table(Settings::Table)
|
||||
.if_not_exists()
|
||||
.col(string_len(Settings::Key, 190).primary_key())
|
||||
.col(string_len(Settings::Scope, 64))
|
||||
.col(text(Settings::Value))
|
||||
.col(timestamp(Settings::UpdatedAt).default(Expr::current_timestamp()))
|
||||
.col(integer_null(Settings::UpdatedBy))
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
manager
|
||||
.create_index(
|
||||
Index::create()
|
||||
.name("idx_settings_scope")
|
||||
.table(Settings::Table)
|
||||
.col(Settings::Scope)
|
||||
.to_owned(),
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.drop_table(Table::drop().table(Settings::Table).to_owned())
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(DeriveIden)]
|
||||
enum Settings {
|
||||
Table,
|
||||
Key,
|
||||
Scope,
|
||||
Value,
|
||||
UpdatedAt,
|
||||
UpdatedBy,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue