fix: oops must first create instances
This commit is contained in:
parent
58c20b7ba5
commit
ab0e7007c5
1 changed files with 31 additions and 31 deletions
|
@ -89,6 +89,37 @@ pub struct Migration;
|
||||||
impl MigrationTrait for Migration {
|
impl MigrationTrait for Migration {
|
||||||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||||
|
|
||||||
|
manager
|
||||||
|
.create_table(
|
||||||
|
Table::create()
|
||||||
|
.table(Instances::Table)
|
||||||
|
.comment("known other instances in the fediverse")
|
||||||
|
.col(
|
||||||
|
ColumnDef::new(Instances::Id)
|
||||||
|
.integer()
|
||||||
|
.not_null()
|
||||||
|
.auto_increment()
|
||||||
|
.primary_key()
|
||||||
|
)
|
||||||
|
.col(ColumnDef::new(Instances::Name).string().null())
|
||||||
|
.col(ColumnDef::new(Instances::Domain).string().not_null())
|
||||||
|
.col(ColumnDef::new(Instances::Software).string().null())
|
||||||
|
.col(ColumnDef::new(Instances::Version).string().null())
|
||||||
|
.col(ColumnDef::new(Instances::DownSince).date_time().null())
|
||||||
|
.col(ColumnDef::new(Instances::Users).integer().null())
|
||||||
|
.col(ColumnDef::new(Instances::Posts).integer().null())
|
||||||
|
.col(ColumnDef::new(Instances::Published).date_time().not_null().default(Expr::current_timestamp()))
|
||||||
|
.col(ColumnDef::new(Instances::Updated).date_time().not_null().default(Expr::current_timestamp()))
|
||||||
|
.to_owned()
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
manager
|
||||||
|
.create_index(Index::create().name("index-instances-domain").table(Instances::Table).col(Instances::Domain).to_owned())
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
manager
|
manager
|
||||||
.create_table(
|
.create_table(
|
||||||
Table::create()
|
Table::create()
|
||||||
|
@ -264,37 +295,6 @@ impl MigrationTrait for Migration {
|
||||||
.create_index(Index::create().name("index-objects-context").table(Objects::Table).col(Objects::Context).to_owned())
|
.create_index(Index::create().name("index-objects-context").table(Objects::Table).col(Objects::Context).to_owned())
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
manager
|
|
||||||
.create_table(
|
|
||||||
Table::create()
|
|
||||||
.table(Instances::Table)
|
|
||||||
.comment("known other instances in the fediverse")
|
|
||||||
.col(
|
|
||||||
ColumnDef::new(Instances::Id)
|
|
||||||
.integer()
|
|
||||||
.not_null()
|
|
||||||
.auto_increment()
|
|
||||||
.primary_key()
|
|
||||||
)
|
|
||||||
.col(ColumnDef::new(Instances::Name).string().null())
|
|
||||||
.col(ColumnDef::new(Instances::Domain).string().not_null())
|
|
||||||
.col(ColumnDef::new(Instances::Software).string().null())
|
|
||||||
.col(ColumnDef::new(Instances::Version).string().null())
|
|
||||||
.col(ColumnDef::new(Instances::DownSince).date_time().null())
|
|
||||||
.col(ColumnDef::new(Instances::Users).integer().null())
|
|
||||||
.col(ColumnDef::new(Instances::Posts).integer().null())
|
|
||||||
.col(ColumnDef::new(Instances::Published).date_time().not_null().default(Expr::current_timestamp()))
|
|
||||||
.col(ColumnDef::new(Instances::Updated).date_time().not_null().default(Expr::current_timestamp()))
|
|
||||||
.to_owned()
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
manager
|
|
||||||
.create_index(Index::create().name("index-instances-domain").table(Instances::Table).col(Instances::Domain).to_owned())
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue