我们先来看一下 Ecto 文档中对 Migration 与 Schema 的描述:
Migration
Migrations are used to modify your database schema over time.
可以看出 Migration 是用来修改数据库的 schema 的,这里的 schema 或许与我们之后的所指不同.
Schema
Defines a schema.
An Ecto schema is used to map any data source into an Elixir struct. One of such use cases is to map data coming from a repository,usually a table,into Elixir structs.
或许我们可以这样理解,Database Schema 农场里原本的仓库,Migration 的作用是用不同的仓库来养鸡养牛,Ecto Schema 的作用是把这些动物做成吃的.