fix: sqlite won't update columns anyway

since this migration breaks all sqlite dbs, i changed the original
migration so that future ones won't panic when reaching here. note that,
if you are on sqlite, just `sqlite3 <your_db> .dump > backup.sql` and
then, after rebuilding and re-migrating db, `cat backup.sql | sqlite3 <your_db>`
This commit is contained in:
əlemi 2024-04-21 16:30:29 +02:00
parent 46a2e53da0
commit a083edef6e
Signed by: alemi
GPG key ID: A4895B84D311642C
3 changed files with 1 additions and 51 deletions

View file

@ -19,7 +19,7 @@ impl MigrationTrait for Migration {
)
.col(ColumnDef::new(Addressing::Actor).string().not_null())
.col(ColumnDef::new(Addressing::Server).string().not_null())
.col(ColumnDef::new(Addressing::Activity).string().not_null())
.col(ColumnDef::new(Addressing::Activity).string().null())
.col(ColumnDef::new(Addressing::Object).string().null())
.col(ColumnDef::new(Addressing::Published).date_time().not_null())
.to_owned()

View file

@ -1,48 +0,0 @@
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> {
manager
.alter_table(
Table::alter()
.table(Addressing::Table)
.modify_column(
ColumnDef::new(Addressing::Activity)
.string()
.null()
)
.to_owned()
)
.await?;
Ok(())
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.alter_table(
Table::alter()
.table(Addressing::Table)
.modify_column(
ColumnDef::new(Addressing::Activity)
.string()
.not_null()
.default("")
)
.to_owned()
)
.await?;
Ok(())
}
}
#[derive(DeriveIden)]
enum Addressing {
Table,
Activity,
}

View file

@ -10,7 +10,6 @@ mod m20240324_000001_add_addressing;
mod m20240325_000001_add_deliveries;
mod m20240325_000002_add_system_key;
mod m20240418_000001_add_statuses_and_reply_to;
mod m20240421_000001_make_addressed_activity_nullable;
pub struct Migrator;
@ -28,7 +27,6 @@ impl MigratorTrait for Migrator {
Box::new(m20240325_000001_add_deliveries::Migration),
Box::new(m20240325_000002_add_system_key::Migration),
Box::new(m20240418_000001_add_statuses_and_reply_to::Migration),
Box::new(m20240421_000001_make_addressed_activity_nullable::Migration),
]
}
}