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> {
// Tombstone table for tracking deleted remote actors.
// When we fetch a remote actor and get 410 Gone, we record it here
// to avoid repeatedly trying to fetch it.
manager
.get_connection()
.execute_unprepared(
"CREATE TABLE IF NOT EXISTS ap_remote_actor_tombstones (
id INTEGER PRIMARY KEY AUTOINCREMENT,
actor_url TEXT NOT NULL UNIQUE,
gone_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP
)",
)
.await?;
Ok(())
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.get_connection()
.execute_unprepared("DROP TABLE IF EXISTS ap_remote_actor_tombstones")
.await?;
Ok(())
}
}