From 4a3a2e2647218e2e20d3e2062b5526534921d935 Mon Sep 17 00:00:00 2001 From: alemi Date: Sun, 23 Jun 2024 16:56:34 +0200 Subject: [PATCH] fix!: attachment url no longer unique, add an index --- .../m20240524_000005_create_attachments_tags_mentions.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/upub/migrations/src/m20240524_000005_create_attachments_tags_mentions.rs b/upub/migrations/src/m20240524_000005_create_attachments_tags_mentions.rs index 225cbc79..e3c6eee7 100644 --- a/upub/migrations/src/m20240524_000005_create_attachments_tags_mentions.rs +++ b/upub/migrations/src/m20240524_000005_create_attachments_tags_mentions.rs @@ -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()