Skip to content

Commit

Permalink
fix(migration): ignore duplicate indices (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsonck92 authored Jul 27, 2024
1 parent 3a1fde6 commit 00c0377
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions migrations/src/m20240718_000003_create_workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 2 additions & 0 deletions migrations/src/m20240718_000004_create_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
4 changes: 4 additions & 0 deletions migrations/src/m20240718_000005_create_invitation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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(),
Expand Down
4 changes: 4 additions & 0 deletions migrations/src/m20240718_000007_create_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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(),
Expand Down
5 changes: 5 additions & 0 deletions migrations/src/m20240718_000009_create_grouppermission.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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(),
Expand All @@ -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(),
Expand Down
6 changes: 6 additions & 0 deletions migrations/src/m20240718_000010_create_userpermission.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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(),
Expand All @@ -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(),
Expand Down

0 comments on commit 00c0377

Please sign in to comment.