草庐IT

migrations

全部标签

python - Flask-Migrate 不创建表

我在文件listpull/models.py中有以下模型:fromdatetimeimportdatetimefromlistpullimportdbclassJob(db.Model):id=db.Column(db.Integer,primary_key=True)list_type_id=db.Column(db.Integer,db.ForeignKey('list_type.id'),nullable=False)list_type=db.relationship('ListType',backref=db.backref('jobs',lazy='dynamic'))rec

python - Django 1.8 migrate 没有创建表

yekabathula-macbookair2:rosteryekabathula$pythonmanage.pymigrateOperationstoperform:Synchronizeunmigratedapps:staticfiles,messagesApplyallmigrations:admin,contenttypes,api,auth,sessionsSynchronizingappswithoutmigrations:Creatingtables...RunningdeferredSQL...InstallingcustomSQL...Runningmigration

python - 解决 "django.db.utils.ProgrammingError: permission denied for relation django_migrations"的步骤

有哪些基本步骤可以排除Django的“django.db.utils.ProgrammingError:permissiondeniedforrelationshipdjango_migrations”错误的原因?在最初是一个稳定的生产服务器之后,我收到了这条消息,但后来对Django、Postgres、Apache和Github的几个方面进行了一些更改。此外,这些更改已经有一段时间了,我不记得或无法跟踪可能导致问题的每一个更改。我在运行pythonmanage.pyrunserver或任何其他pythonmanage.py...命令时收到消息,除了pythonmanage.pyche

python - Django 1.8 和 syncdb/migrate 的 auth_user 错误

当升级到Django1.8(使用zc.buildout)并运行syncdb或migrate时,我收到以下消息:django.db.utils.ProgrammingError:关系“auth_user”不存在我的一个模型包含django.contrib.auth.models.User:user=models.ForeignKey(User,related_name='%(app_label)s_%(class)s_user',blank=True,null=True,editable=False)降级到Django1.7可以消除该错误。我必须在Django1.8中以不同的方式包含Us

python - Django 1.7 - "No migrations to apply"在 makemigrations 后运行迁移时

我使用Django1.7和Mezzanine。我创建了存储在单独的应用程序“配置文件”中的简单配置文件(根据夹层文档):classRoadmapProfile(models.Model):user=models.OneToOneField("auth.User")fullname=models.CharField(max_length=100,verbose_name="Fullname")创建迁移返回:Migrationsfor'profiles':0001_initial.py:-CreatemodelRoadmapProfile当我运行“迁移配置文件”时:Operationsto

ruby-on-rails - MySQL 问题 - RAILS_ENV=production bundle exec rake db :migrate

由于detailedmanual,我只是将redmine安装到我的服务器上.一切顺利,但最后一步因一些错误而失败,我不知道如何修复它。命令是RAILS_ENV=productionbundleexecrakedb:migrate输出错误Youcannotspecifythesamegemtwicewithdifferentversionrequirements.Youspecified:mysql(>=0)andmysql(~>2.9.1)gem列表***LOCALGEMS***actionmailer(3.2.15)actionpack(3.2.15)activemodel(3.2.

ruby-on-rails - ActiveRecord::Migration.say_with_time() 做

当我们应该在种子文件中使用它时。在rails框架事件记录中。ActiveRecord::Migration.say_with_time()do 最佳答案 此方法获取一个block并对其进行基准测试。打印出花费的时间和受影响的行数。例如来自文档:say_with_time"Revertingallserviceratestonil."doService.update_all(:rate,nil)end#Output--Revertingallserviceratestonil.->0.3451s->2233rows

ruby-on-rails - 防止 rake migrate 创建外键约束

我们有一个情况,其中一个表列名称使用后缀“_id”。迁移代码:create_table:companiesdo|t|t.integer:ref_idt.string:nameend当运行db:migrate时,它​​失败了,因为rails试图为ref_id创建外键约束,但发现没有名为“refs”的表。在我们的例子中,“ref_id”不是外键。我们有没有办法阻止Rails为该列创建外键约束? 最佳答案 看来您有一个schema_plusgem。你可以这样做:create_table:companiesdo|t|t.integer:re

ruby - rake 数据库 :migrate runs into an error for an undefined method

我接管了一个由其他人建立的网站。我现在正试图在本地主机上启动并运行它。但是,当我迁移时,看起来以前的开发人员将代码放入可能依赖于已经存在的种子的迁移中。迁移文件如下所示。defupadd_column:supplies,:color,:stringSupply.where(:title=>"Shipped").first.update(:color=>'#e20ce8')enddefdownremove_column:supplies,:colorend当我运行rakedb:migrate时我在这个文件上遇到的错误是...rakeaborted!StandardError:Anerro

ruby-on-rails - Heroku rake 数据库 :migrate

Heroku告诉我,有些迁移尚未运行,但显然它们已经运行。看起来它是在一次迁移之后。我该如何解决这个问题。当我运行rakedb:migrate时,它告诉我rakeabortedMysql2::Error:Duplicatecolumnname。我知道这些字段已经创建,也很确定迁移运行了,因为这些字段在任何其他迁移中都不存在,并且rakedb:migrate在我的本地系统上运行得很好。我该如何解决这个问题?我认为Heroku只是没有意识到它已经运行了迁移。我怎么能告诉它“你已经运行了migrationxxx”? 最佳答案 这可能意味着