From 00c03772115c1e1ffc9358092d6ed7c4220904a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Sonck?= Date: Sun, 28 Jul 2024 01:03:33 +0200 Subject: [PATCH] fix(migration): ignore duplicate indices (#243) --- migrations/src/m20240718_000003_create_workspace.rs | 1 + migrations/src/m20240718_000004_create_group.rs | 2 ++ migrations/src/m20240718_000005_create_invitation.rs | 4 ++++ migrations/src/m20240718_000007_create_file.rs | 4 ++++ migrations/src/m20240718_000009_create_grouppermission.rs | 5 +++++ migrations/src/m20240718_000010_create_userpermission.rs | 6 ++++++ 6 files changed, 22 insertions(+) diff --git a/migrations/src/m20240718_000003_create_workspace.rs b/migrations/src/m20240718_000003_create_workspace.rs index 735ed0a9a..532ecd809 100644 --- a/migrations/src/m20240718_000003_create_workspace.rs +++ b/migrations/src/m20240718_000003_create_workspace.rs @@ -75,6 +75,7 @@ impl MigrationTrait for Migration { .create_index( Index::create() .name("workspace_organization_id_idx") + .if_not_exists() .table(Workspace::Table) .col(Workspace::OrganizationId) .to_owned(), diff --git a/migrations/src/m20240718_000004_create_group.rs b/migrations/src/m20240718_000004_create_group.rs index c6e6c1e03..781c6e400 100644 --- a/migrations/src/m20240718_000004_create_group.rs +++ b/migrations/src/m20240718_000004_create_group.rs @@ -58,6 +58,8 @@ impl MigrationTrait for Migration { manager .create_index( Index::create() + .name("group_organization_id_idx") + .if_not_exists() .table(Group::Table) .col(Group::OrganizationId) .to_owned(), diff --git a/migrations/src/m20240718_000005_create_invitation.rs b/migrations/src/m20240718_000005_create_invitation.rs index e38daff39..01c3eb061 100644 --- a/migrations/src/m20240718_000005_create_invitation.rs +++ b/migrations/src/m20240718_000005_create_invitation.rs @@ -63,6 +63,8 @@ impl MigrationTrait for Migration { manager .create_index( Index::create() + .name("invitation_organization_id_idx") + .if_not_exists() .table(Invitation::Table) .col(Invitation::OrganizationId) .to_owned(), @@ -71,6 +73,8 @@ impl MigrationTrait for Migration { manager .create_index( Index::create() + .name("invitation_user_id_idx") + .if_not_exists() .table(Invitation::Table) .col(Invitation::OwnerId) .to_owned(), diff --git a/migrations/src/m20240718_000007_create_file.rs b/migrations/src/m20240718_000007_create_file.rs index b77793512..4208a8eab 100644 --- a/migrations/src/m20240718_000007_create_file.rs +++ b/migrations/src/m20240718_000007_create_file.rs @@ -95,6 +95,8 @@ impl Migration { manager .create_index( Index::create() + .name("file_parent_id_idx") + .if_not_exists() .table(File::Table) .col(File::ParentId) .to_owned(), @@ -103,6 +105,8 @@ impl Migration { manager .create_index( Index::create() + .name("file_workspace_id_idx") + .if_not_exists() .table(File::Table) .col(File::WorkspaceId) .to_owned(), diff --git a/migrations/src/m20240718_000009_create_grouppermission.rs b/migrations/src/m20240718_000009_create_grouppermission.rs index c9f89b72b..f9513985b 100644 --- a/migrations/src/m20240718_000009_create_grouppermission.rs +++ b/migrations/src/m20240718_000009_create_grouppermission.rs @@ -51,6 +51,7 @@ impl MigrationTrait for Migration { manager .create_index( Index::create() + .name("grouppermission_group_id_resource_id_idx") .table(Grouppermission::Table) .col(Grouppermission::GroupId) .col(Grouppermission::ResourceId) @@ -62,6 +63,8 @@ impl MigrationTrait for Migration { manager .create_index( Index::create() + .name("grouppermission_group_id_idx") + .if_not_exists() .table(Grouppermission::Table) .col(Grouppermission::GroupId) .to_owned(), @@ -70,6 +73,8 @@ impl MigrationTrait for Migration { manager .create_index( Index::create() + .name("grouppermission_resource_id_idx") + .if_not_exists() .table(Grouppermission::Table) .col(Grouppermission::ResourceId) .to_owned(), diff --git a/migrations/src/m20240718_000010_create_userpermission.rs b/migrations/src/m20240718_000010_create_userpermission.rs index c41bb87c6..478ee35c6 100644 --- a/migrations/src/m20240718_000010_create_userpermission.rs +++ b/migrations/src/m20240718_000010_create_userpermission.rs @@ -51,6 +51,8 @@ impl MigrationTrait for Migration { manager .create_index( Index::create() + .name("userpermission_user_id_resource_id_idx") + .if_not_exists() .table(Userpermission::Table) .col(Userpermission::UserId) .col(Userpermission::ResourceId) @@ -62,6 +64,8 @@ impl MigrationTrait for Migration { manager .create_index( Index::create() + .name("userpermission_user_id_idx") + .if_not_exists() .table(Userpermission::Table) .col(Userpermission::UserId) .to_owned(), @@ -70,6 +74,8 @@ impl MigrationTrait for Migration { manager .create_index( Index::create() + .name("userpermission_resource_id_idx") + .if_not_exists() .table(Userpermission::Table) .col(Userpermission::ResourceId) .to_owned(),