Last active
November 17, 2020 12:36
-
-
Save marinho10/6bf9df674cbfa03fa0262d405bb51975 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MyApp.Repo.Migrations.AddTableUserProject do | |
use Ecto.Migration | |
def change do | |
create table(:user_project, primary_key: false) do | |
add(:project_id, references(:project, on_delete: :delete_all), primary_key: true) | |
add(:user_id, references(:user, on_delete: :delete_all), primary_key: true) | |
timestamps() | |
end | |
create(index(:user_project, [:project_id])) | |
create(index(:user_project, [:user_id])) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment