Bump: 0.5.0 : unlisted, password and locked stream support

This commit is contained in:
2026-08-16 14:56:29 +01:00
parent 9960434c1c
commit 0c6705badd
13 changed files with 319 additions and 45 deletions
+4
View File
@@ -4,6 +4,8 @@ mod m20260616_000001_create_users;
mod m20260616_000002_create_stream_key;
mod m20260616_000003_create_stream_session;
mod m20260616_000004_create_auth_session;
mod m20260815_000005_add_password_to_stream_key;
mod m20260815_000006_set_stream_keys_unlisted;
pub struct Migrator;
@@ -15,6 +17,8 @@ impl MigratorTrait for Migrator {
Box::new(m20260616_000002_create_stream_key::Migration),
Box::new(m20260616_000003_create_stream_session::Migration),
Box::new(m20260616_000004_create_auth_session::Migration),
Box::new(m20260815_000005_add_password_to_stream_key::Migration),
Box::new(m20260815_000006_set_stream_keys_unlisted::Migration),
]
}
}
@@ -38,7 +38,7 @@ impl MigrationTrait for Migration {
ColumnDef::new(StreamKey::IsUnlisted)
.boolean()
.not_null()
.default(true),
.default(false),
)
.col(ColumnDef::new(StreamKey::CreatedAt).date_time().not_null())
.foreign_key(
@@ -67,5 +67,7 @@ pub enum StreamKey {
Label,
IsActive,
IsUnlisted,
Password,
CustomId,
CreatedAt,
}
@@ -0,0 +1,47 @@
use sea_orm_migration::prelude::*;
use super::m20260616_000002_create_stream_key::StreamKey;
#[derive(DeriveMigrationName)]
pub struct Migration;
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.alter_table(
Table::alter()
.table(StreamKey::Table)
.add_column(ColumnDef::new(StreamKey::Password).string().null())
.to_owned(),
)
.await?;
manager
.alter_table(
Table::alter()
.table(StreamKey::Table)
.add_column(ColumnDef::new(StreamKey::CustomId).string().null())
.to_owned(),
)
.await
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.alter_table(
Table::alter()
.table(StreamKey::Table)
.drop_column(StreamKey::Password)
.to_owned(),
)
.await?;
manager
.alter_table(
Table::alter()
.table(StreamKey::Table)
.drop_column(StreamKey::CustomId)
.to_owned(),
)
.await
}
}
@@ -0,0 +1,26 @@
use sea_orm_migration::prelude::*;
use super::m20260616_000002_create_stream_key::StreamKey;
#[derive(DeriveMigrationName)]
pub struct Migration;
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
// By accident the is_unlisted column defaulted to true; existing stream
// keys were meant to be listed. Reset all rows to false here.
manager
.exec_stmt(
Query::update()
.table(StreamKey::Table)
.values([(StreamKey::IsUnlisted, false.into())])
.to_owned(),
)
.await
}
async fn down(&self, _manager: &SchemaManager) -> Result<(), DbErr> {
Ok(())
}
}