String and atom in the definations of shema and migration

When reading Getting Started of Ecto, I found:

In migrations, the table name is an atom:

defmodule Friends.Repo.Migrations.CreatePeople do
  use Ecto.Migration

  def change do
    create table(:people) do # here is an atom
      add :first_name, :string
      add :last_name, :string
      add :age, :integer
    end
  end
end

In schemas, the table name is a string:

defmodule Friends.Person do
  use Ecto.Schema

  schema "people" do # here is a string
    field :first_name, :string
    field :last_name, :string
    field :age, :integer
  end
end

Is there any good reason to make this kind of distinction?

1 Like

In the migration the table name can be a string as well. So no there‘s no greater reason besides maybe convenience.

2 Likes