fix!: attachment url no longer unique, add an index

This commit is contained in:
əlemi 2024-06-23 16:56:34 +02:00
parent 2e7b7074ea
commit 4a3a2e2647
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -50,7 +50,7 @@ impl MigrationTrait for Migration {
.primary_key()
.auto_increment()
)
.col(ColumnDef::new(Attachments::Url).string().not_null().unique_key())
.col(ColumnDef::new(Attachments::Url).string().not_null())
.col(ColumnDef::new(Attachments::Object).big_integer().not_null())
.foreign_key(
ForeignKey::create()
@ -72,6 +72,10 @@ impl MigrationTrait for Migration {
.create_index(Index::create().name("index-attachment-object").table(Attachments::Table).col(Attachments::Object).to_owned())
.await?;
manager
.create_index(Index::create().name("index-attachment-url").table(Attachments::Table).col(Attachments::Url).to_owned())
.await?;
manager
.create_table(
Table::create()