7

我一直在思考migrating a Django app最近几天的含义,并听说要使用django-south迁移 Django 应用程序。也许只是缺乏足够的英语技能(因为英语不是我的母语),或者这是您在程序员的生活中遇到的事情之一,它是如此简单,以至于需要天才才能理解它们(起初)。

我已经阅读了我的母语中“迁移”的翻译,阅读了migration维基百科上的定义并阅读了 django-south的“想法”,引用:

使用 South,您安装它,然后为您的一个或多个应用程序提供一些迁移(手动编写它们,或者从您的模型定义中自动生成它们)。当你 syncdb 时,你只会同步没有迁移的应用程序(例如 django.contrib.auth 之类的东西,它有一个固定的模式),然后当你运行 ./manage.py migrate 时,South 会启动并进行迁移。聪明地。

这令人困惑,我仍然不了解“django 应用程序迁移”或“一般迁移”背后的全部内容。如果我知道如何解释这个词,我会明白migration

你明白了,我希望。

对我有耐心,但我真的很想知道。所以也许你们中的一个可以解释一下,拜托。

提前感谢您的时间。

4

2 回答 2

10

When it comes to talking about South and Django, a migration refers to changing the database schema.

The syncdb command that is built into Django cannot automatically change schema for you without deleting everything first, which is why things like South and dmigrations have come about.

So, essentially a migration is a way to alter your database schema while keeping your data intact.

From the dmigrations page:

With dmigrations, every change to your database (including the creation of your initial tables) is bundled up in a migration. Migrations are Python files that live in a migrations directory. They can be applied and un-applied (reverted) in sequence.

于 2009-12-22T23:51:41.690 回答
1

迁移通常是指将应用程序从一个位置移动到另一个位置。这种翻译可以通过物理运动发生。(例如从一台服务器移动到另一台服务器),或者作为更合乎逻辑的移动。(比如从 C# 到 F#)

鉴于只提到了一种技术。它可能主要是一个物理移动应用程序,数据库端有轻微的逻辑移动。

总结应用程序的功能。它可能只是将所有配置和数据导出到文件结构,然后可以将其重新集成到新服务器上的数据库中。

于 2009-12-22T23:47:58.337 回答