Ecto - inheriting nested associations

I'm trying to create a migration for my table folders:

schema "folders" do
  field(:name, :string)
  field(:context, :string, default: "workspace")

  has_many(:files, Application.File, on_delete: :nilify_all)
  has_many(:contracts, Application.Contract, on_delete: :nilify_all)
  has_many(:child_folders, Application.Folder, foreign_key: :parent_id)

  belongs_to(:project, Application.Project)
  belongs_to(:parent, __MODULE__, foreign_key: :parent_id, on_replace: :nilify)

  belongs_to(:creator, Application.User, foreign_key: :creator_id)
  belongs_to(:contact, Application.User, foreign_key: :contact_id)

  embeds_one(:permission, Application.Permission, on_replace: :delete)

  has_many(:folder_groups, Application.FolderGroup, on_replace: :delete, on_delete: :delete_all)
  has_many(:groups, through: [:folder_groups, :group])


What I want is for each :child_folder to inherit the :groups of their :parent. I already managed to modify my changeset such that creating a new child folder will exhibit such behavior. I'm trying to compose a migration to apply the same for the existing folder records in my repo.