加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 创业 > C语言 > 正文

Ecto 中 Migration 与 Schema 的区别

发布时间:2020-12-15 00:04:30 所属栏目:C语言 来源:网络整理
导读:我们先来看一下 Ecto 文档中对 Migration 与 Schema 的描述: Migration Migrations are used to modify your database schema over time. 可以看出 Migration 是用来修改数据库的 schema 的,这里的 schema 或许与我们之后的所指不同. Schema Defines a schem

我们先来看一下 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 的作用是把这些动物做成吃的.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读