Add a relationship between a user and links.

This commit is contained in:
2024-09-01 21:25:07 +03:00
parent 1b6651bab9
commit 499c5e5cc2
3 changed files with 19 additions and 2 deletions
@@ -0,0 +1,11 @@
defmodule LinkShortener.Repo.Migrations.AddRelationshipBetweenUsersAndLinks do
use Ecto.Migration
def change do
alter table(:links) do
add :user_id, references(:users, on_delete: :delete_all), null: false
end
create index(:links, [:user_id])
end
end