Skip to content

Instantly share code, notes, and snippets.

@marinho10
Last active November 17, 2020 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marinho10/6bf9df674cbfa03fa0262d405bb51975 to your computer and use it in GitHub Desktop.
Save marinho10/6bf9df674cbfa03fa0262d405bb51975 to your computer and use it in GitHub Desktop.
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