我想运行一些迁移。一切似乎都运行正常,直到我想运行我的网站。缺少一列。我可以手动修复它,但我想了解我在运行迁移时犯的错误。
这是我的migraton文件的一部分,其中添加了列:
migrations.CreateModel(
name='PostTranslation',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language', choices=settings.LANGUAGES)),
('title', models.CharField(max_length=255, verbose_name='Title')),
('slug', models.SlugField(verbose_name='slug', blank=True)),
('abstract', djangocms_text_ckeditor.fields.HTMLField(verbose_name='Abstract')),
('meta_description', models.TextField(default=b'', verbose_name='Post meta description', blank=True)),
('meta_keywords', models.TextField(default=b'', verbose_name='Post meta keywords', blank=True)),
('meta_title', models.CharField(default=b'', help_text='used in title tag and social sharing', max_length=255, verbose_name='Post meta title', blank=True)),
('post_text', djangocms_text_ckeditor.fields.HTMLField(default=b'', verbose_name='Text', blank=True)),
('master', models.ForeignKey(related_name='translations', editable=False, to='djangocms_blog.Post', null=True)),
],
options={
'db_table': 'djangocms_blog_post_translation',
'verbose_name': 'blog article Translation',
'default_permissions': (),
},
bases=(models.Model,),
这些是我正在运行的命令:
python manage.py migrate djangocms_blog 0001
在第一步中,创建了 meta_title 列
如果我运行迁移,shell输出:
Operations to perform:
Target specific migration: 0001_initial, from djangocms_blog
Running migrations:
Unapplying djangocms_blog.0005_auto_20150115_1444... OK
Unapplying djangocms_blog.0004_auto_20150108_1435... OK
Unapplying djangocms_blog.0003_auto_20141201_2252... OK
Unapplying djangocms_blog.0002_post_sites... OK
此时我希望meta_title列在数据库中创建......但没有任何反应...... 我确定我在正确的数据库中并且我的设置是正确的。因为如果我手动创建meta_title列,网站将运行无错误。
有人能帮助我吗?