Skip to content

Commit

Permalink
WIP3
Browse files Browse the repository at this point in the history
  • Loading branch information
rbino committed Oct 3, 2024
1 parent a611765 commit f124954
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions backend/lib/edgehog/base_images/base_image/base_image.ex
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ defmodule Edgehog.BaseImages.BaseImage do
table "base_images"
repo Edgehog.Repo

custom_indexes do
index [:base_image_collection_id], unique: false
references :base_image_collection do
index? true
end
end
end
4 changes: 2 additions & 2 deletions backend/lib/edgehog/multitenant_resource.ex
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ defmodule Edgehog.MultitenantResource do
custom_indexes do
# Assumptions:
# - There is a primary key and it's called :id
index [:id], unique: true
index [:tenant_id], all_tenants?: false
index [:id, :tenant_id], unique: true, all_tenants?: true
index [:tenant_id], all_tenants?: true
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,12 @@ defmodule Edgehog.Repo.Migrations.ReconcileWithAsh do
)

drop_if_exists index(:base_images, [:base_image_collection_id, :tenant_id])
create index(:base_images, [:tenant_id, :base_image_collection_id])

create index(
:base_images,
[:tenant_id, :base_image_collection_id],
"base_images_base_image_collection_id_index"
)

drop_if_exists unique_index(:base_images, [:handle, :tenant_id])
create unique_index(:base_images, [:tenant_id, :handle], name: "base_images_handle_index")
Expand Down

0 comments on commit f124954

Please sign in to comment.