I am using the auto generated primary key for the following migrations but it could not work,
What wrong did I make
the parent table migration is :
defmodule Keen.Repo.Migrations.CreateCourseSections do
use Ecto.Migration
def change do
create table(:course_sections) do
add :description, :string
add(:course_id, references(:courses, on_delete: :delete_all), primary_key: true)
timestamps()
end
end
end
The child table is
defmodule Keen.Repo.Migrations.CreateCourseSectionFiles do
use Ecto.Migration
def change do
create table(:course_section_files) do
add :name, :string
add :uri, :string
add(:course_section_id, references(:course_sections, on_delete: :delete_all),
primary_key: true
)
timestamps()
end
end
end