これは私のmodels.pyです:移行を実行しようとすると、「次のコンテンツタイプが古く、削除する必要があります。これはどういう意味ですか、どうすれば解決できますか?
class Notification(models.Model):
user = models.ForeignKey(User)
createdAt = models.DateTimeField(auto_now_add=True, blank=True)
read = models.BooleanField(default=False, blank=True)
class Meta:
abstract = True
class RegularNotification(Notification):
message = models.CharField(max_length=150)
link = models.CharField(max_length=100)
class FNotification(Notification):
# same as Notification
pass
私はpython manage.py makemigrations
を行うと、これはそれが言うことである:
Migrations for 'CApp':
0019_auto_20151202_2228.py:
- Create model RegularNotification
- Create model FNotification
- Remove field user from notification
- Add field f_request to userextended
- Delete model Notification
まずuser
が私Notiication
モデルにまだあるので、それはそれはRemove field user from notification
を言うことを奇妙です(なぜ誰かが「通知からフィールドユーザを削除する」と言う理由を理解できればそれはすばらしいことです!)しかし、私が移動してやろうとするとpython manage.py migrate
私はこのメッセージを受け取ります:
Applying CMApp.0019_auto_20151202_2228... OK
The following content types are stale and need to be deleted:
CApp | notification
Any objects related to these content types by a foreign key will also
be deleted. Are you sure you want to delete these content types?
If you're unsure, answer 'no'.
Type 'yes' to continue, or 'no' to cancel: no
私はno
とタイプしました。しかし、正確にはどういう意味ですか、なぜ私はこのメッセージを受け取っていますか、私はこのメッセージを必要としないようにするにはどうすればいいですか?
私はリポジトリの最後のコミットをプルするのを忘れてしまったので、これを得ました。私の最新のローカル移行は、リポジトリの最新のものではありませんでした。 :P私はリモートコードを引っ張って、私は再びマイグレーションを行い、私は魅力的に働いた。 – joaorodr84