- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个现有的 Django 项目,之前有 25 次成功迁移。
我将模型中的一些字段更改为不同的类型,例如将 m2m 字段更改为文本字段,我现在正在尝试迁移它。
我跑了:
python manage.py schemamigration 后端 --auto
然后
python manage.py 迁移
我得到以下信息
backend:0026_auto__del_vehicle__del_assetproperty__del_liabilityproperty__del_banka FATAL ERROR - The following SQL query failed: ALTER TABLE
backend_userprofile
MODIFYprevious_address
longtext NULL;; The error was: (1170, "BLOB/TEXT column 'previous_address' used in key specification without a key length") ! Error found during real run of migration! Aborting.
! Since you have a database that does not support running
! schema-altering statements in transactions, we have had
! to leave it in an interim state between migrations.
! You *might* be able to recover with: = CREATE INDEX `backend_userprofile_a44d8d16` ON `backend_userprofile` (`employer_address_id`); []
= CREATE INDEX `backend_userprofile_eb751626` ON `backend_userprofile` (`previous_address_id`); []
= CREATE INDEX `backend_userprofile_174f2184` ON `backend_userprofile` (`employer_phone_id`); []
= CREATE TABLE `backend_vehicle` (`make` varchar(30) NOT NULL, `financial_status` integer NOT NULL, `values` numeric(30, 2) NOT NULL, `year` date NOT NULL, `model` varchar(30) NOT NULL, `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY); []
= CREATE TABLE `backend_assetproperty` (`registered_name` varchar(30) NOT NULL, `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `estimate_value` numeric(30, 2) NOT NULL, `purchase_price` numeric(30, 2) NOT NULL); []
= CREATE TABLE `backend_liabilityproperty` (`taxes_included` bool NOT NULL, `insured` bool NOT NULL, `monthly_payment` numeric(30, 2) NOT NULL, `payment_type` integer NOT NULL, `landlord` varchar(30) NOT NULL, `property_taxes` numeric(30, 2) NOT NULL, `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `amount_owing` numeric(30, 2) NOT NULL); []
= CREATE TABLE `backend_bankaccountasset` (`balance` numeric(30, 2) NOT NULL, `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `bank_name` varchar(30) NOT NULL); []
= CREATE TABLE `backend_credit` (`paid_in_full` bool NOT NULL, `monthly_payment` numeric(30, 2) NOT NULL, `person_business` integer NOT NULL, `balance` numeric(30, 2) NOT NULL, `institution_name` varchar(30) NOT NULL, `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `credit_limit` numeric(30, 2) NOT NULL); []
= DROP TABLE `backend_liability` CASCADE; []
= DROP TABLE `backend_asset` CASCADE; []
= DROP TABLE `backend_otherincome` CASCADE; []
= ALTER TABLE `backend_userprofile` ADD COLUMN `bank_branch_number` integer NULL; []
- no dry run output for alter_column() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` ADD COLUMN `address_id` integer NULL; []
- no dry run output for alter_column() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` ADD COLUMN `gross_monthly_income` numeric(30, 2) NULL; []
- no dry run output for alter_column() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` ADD COLUMN `other_income` numeric(30, 2) NULL; []
- no dry run output for alter_column() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` ADD COLUMN `bank_phone_id` integer NULL; []
- no dry run output for alter_column() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` ADD COLUMN `bank_contact_details_id` integer NULL; []
- no dry run output for alter_column() due to dynamic DDL, sorry
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `current_address` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `current_unit_number` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `current_city` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `current_province` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `current_postal_code` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `current_time_at_residence` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `previous_unit_number` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `previous_city` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `previous_province` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `previous_postal_code` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `employment_position` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `employmer_manager_name` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `employment_duration_years` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `employment_duration_months` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `employer_unit_number` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `employer_city` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `employer_province` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `employer_postal_code` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `previous_employment_type` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `previous_employer_phone` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `previous_employer_address` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `previous_employer_unit_number` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `previous_employer_city` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `previous_employer_province` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `previous_employer_postal_code` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `employment_monthly_income` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `bank_contact_phone` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `bank_contact_fax` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `bank_institution_number` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `bank_transit_number` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `bank_address` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `bank_unit_number` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `bank_city` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `bank_province` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `bank_postal_code` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `residence_type` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `residence_value` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `residence_monthly_payment` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `claimed_bankruptcy` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `fraud_alerts` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `credit_consent` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `notes` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `signature` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `cobuyer_relationship` CASCADE; []
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
= ALTER TABLE `backend_userprofile` DROP COLUMN `cobuyer_other` CASCADE; []
= CREATE TABLE `backend_userprofile_vehicles` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `userprofile_id` integer NOT NULL, `vehicle_id` integer NOT NULL); []
= ALTER TABLE `backend_userprofile_vehicles` ADD CONSTRAINT `backend_userprofile_vehicl_userprofile_id_2118f7c8e02a7a01_uniq` UNIQUE (`userprofile_id`, `vehicle_id`) []
= CREATE TABLE `backend_userprofile_bank_accounts_asset` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `userprofile_id` integer NOT NULL, `bankaccountasset_id` integer NOT NULL); []
= ALTER TABLE `backend_userprofile_bank_accounts_asset` ADD CONSTRAINT `backend_userprofile_bank_a_userprofile_id_3780e7dea36fdd1b_uniq` UNIQUE (`userprofile_id`, `bankaccountasset_id`) []
= CREATE TABLE `backend_userprofile_credit` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `userprofile_id` integer NOT NULL, `credit_id` integer NOT NULL); []
= ALTER TABLE `backend_userprofile_credit` ADD CONSTRAINT `backend_userprofile_credit_userprofile_id_aa5c94a808f9fb7_uniq` UNIQUE (`userprofile_id`, `credit_id`) []
= CREATE TABLE `backend_userprofile_property_asset` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `userprofile_id` integer NOT NULL, `assetproperty_id` integer NOT NULL); []
= ALTER TABLE `backend_userprofile_property_asset` ADD CONSTRAINT `backend_userprofile_proper_userprofile_id_3397e38f7c83f4db_uniq` UNIQUE (`userprofile_id`, `assetproperty_id`) []
= CREATE TABLE `backend_userprofile_liability_properties` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `userprofile_id` integer NOT NULL, `liabilityproperty_id` integer NOT NULL); []
= ALTER TABLE `backend_userprofile_liability_properties` ADD CONSTRAINT `backend_userprofile_liabil_userprofile_id_21457cbf6edd1007_uniq` UNIQUE (`userprofile_id`, `liabilityproperty_id`) []
= DROP TABLE `backend_userprofile_other_income` CASCADE; []
= DROP TABLE `backend_userprofile_assets` CASCADE; []
= DROP TABLE `backend_userprofile_liabilities` CASCADE; []
=
SELECT kc.`constraint_name`, kc.`column_name`, kc.`table_name`,
kc.`referenced_table_name`, kc.`referenced_column_name`
FROM information_schema.key_column_usage AS kc
WHERE
kc.table_schema = %s
['pomelo_walker']
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
- no dry run output for alter_column() due to dynamic DDL, sorry
=
SELECT kc.`constraint_name`, kc.`column_name`, kc.`table_name`,
kc.`referenced_table_name`, kc.`referenced_column_name`
FROM information_schema.key_column_usage AS kc
WHERE
kc.table_schema = %s
['pomelo_walker']
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
- no dry run output for alter_column() due to dynamic DDL, sorry
=
SELECT kc.`constraint_name`, kc.`column_name`, kc.`table_name`,
kc.`referenced_table_name`, kc.`referenced_column_name`
FROM information_schema.key_column_usage AS kc
WHERE
kc.table_schema = %s
['pomelo_walker']
- no dry run output for delete_foreign_key() due to dynamic DDL, sorry
- no dry run output for alter_column() due to dynamic DDL, sorry
! The South developers regret this has happened, and would
! like to gently persuade you to consider a slightly
! easier-to-deal-with DBMS (one that supports DDL transactions)
! NOTE: The error which caused the migration to fail is further up.
Error in migration: backend:0026_auto__del_vehicle__del_assetproperty__del_liabilityproperty__del_banka
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/chungwu/.virtualenvs/walkerfinancial/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/Users/chungwu/.virtualenvs/walkerfinancial/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/chungwu/.virtualenvs/walkerfinancial/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/chungwu/.virtualenvs/walkerfinancial/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
output = self.handle(*args, **options)
File "/Users/chungwu/.virtualenvs/walkerfinancial/lib/python2.7/site-packages/south/management/commands/migrate.py", line 108, in handle
ignore_ghosts = ignore_ghosts,
File "/Users/chungwu/.virtualenvs/walkerfinancial/lib/python2.7/site-packages/south/migration/__init__.py", line 213, in migrate_app
success = migrator.migrate_many(target, workplan, database)
File "/Users/chungwu/.virtualenvs/walkerfinancial/lib/python2.7/site-packages/south/migration/migrators.py", line 235, in migrate_many
result = migrator.__class__.migrate_many(migrator, target, migrations, database)
File "/Users/chungwu/.virtualenvs/walkerfinancial/lib/python2.7/site-packages/south/migration/migrators.py", line 310, in migrate_many
result = self.migrate(migration, database)
File "/Users/chungwu/.virtualenvs/walkerfinancial/lib/python2.7/site-packages/south/migration/migrators.py", line 133, in migrate
result = self.run(migration)
File "/Users/chungwu/.virtualenvs/walkerfinancial/lib/python2.7/site-packages/south/migration/migrators.py", line 107, in run
return self.run_migration(migration)
File "/Users/chungwu/.virtualenvs/walkerfinancial/lib/python2.7/site-packages/south/migration/migrators.py", line 81, in run_migration
migration_function()
File "/Users/chungwu/.virtualenvs/walkerfinancial/lib/python2.7/site-packages/south/migration/migrators.py", line 57, in <lambda>
return (lambda: direction(orm))
File "/Users/chungwu/Sites/pomelo/walkerfinancial/backend/migrations/0026_auto__del_vehicle__del_assetproperty__del_liabilityproperty__del_banka.py", line 347, in forwards
db.alter_column('backend_userprofile', 'previous_address', self.gf('django.db.models.fields.TextField')(null=True))
File "/Users/chungwu/.virtualenvs/walkerfinancial/lib/python2.7/site-packages/south/db/generic.py", line 44, in _cache_clear
return func(self, table, *args, **opts)
File "/Users/chungwu/.virtualenvs/walkerfinancial/lib/python2.7/site-packages/south/db/generic.py", line 527, in alter_column
self.execute("ALTER TABLE %s %s;" % (self.quote_name(table_name), sql), values)
File "/Users/chungwu/.virtualenvs/walkerfinancial/lib/python2.7/site-packages/south/db/generic.py", line 273, in execute
cursor.execute(sql, params)
File "/Users/chungwu/.virtualenvs/walkerfinancial/lib/python2.7/site-packages/django/db/backends/util.py", line 40, in execute
return self.cursor.execute(sql, params)
File "/Users/chungwu/.virtualenvs/walkerfinancial/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 114, in execute
return self.cursor.execute(query, args)
File "/Users/chungwu/.virtualenvs/walkerfinancial/lib/python2.7/site-packages/MySQLdb/cursors.py", line 201, in execute
self.errorhandler(self, exc, value)
File "/Users/chungwu/.virtualenvs/walkerfinancial/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
django.db.utils.DatabaseError: (1170, "BLOB/TEXT column 'previous_address' used in key specification without a key length")
有什么办法可以解决这个问题吗?
我正在运行 Django 1.4.5 和 South 0.7.6
最佳答案
首先从您应用的迁移文件夹中删除您的最后一次迁移。
然后我会建议删除 m2m 字段,创建一个迁移,然后添加新的文本字段并创建另一个迁移。我认为如果分两步进行,South 应该能够处理这个过程。
关于mysql - 将 m2m 更改为 char 时 Django South 迁移失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15115614/
CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界. 这篇CFSDN的博客文章详解dedecms后台编辑器将回车 改为 的方法由作者收集整理,如果你对
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 6 年前。 Improve th
不是将代码放在正文的头部或末尾(我把它放在正文的末尾),如果我将代码放在 JS 文件中而不是在 html 中它自己的脚本标记,是否可以? (我假设它像任何其他代码一样工作正常,但我问以防万一) 最佳答
我尝试执行从\e 命令编写的查询,但现在我无法执行任何查询,但可以在 PSQL 中执行命令。 现在我注意到这一点,我输入的命令现在在\e 中。 当我关闭\e(尝试运行它)时问题开始了。 最佳答案 ps
我有一个这样的字符串($ 字符总是被其他字符包围): a$b c$d e$f 我希望我的字符串方法在 $ 前面放置一个 \ 并删除换行符: a\$bc\$de\$f 我试过了,但它没有放入 \ 字符:
我需要使用 Java 构建一个 XML 文件。问题是我必须使用一些特殊字符,例如“ć”,然后在我的移动应用程序中读取它。 如果我手动更改 ć 就可以正常工作至 ć在我的 XML 文件中的记事
我有一个removeUser 页面,我在其中使用,然后使用submitForm() 函数进行错误处理。这段代码运行得非常好: export default function RemoveUserPag
我在数据库 “2048-05-21” 中有一个看起来像这样的日期 我只想得到年份,在这一年我只想得到两个后面的数字并将两个前面的数字更改为19 example: data : 2048-05-21 1
public class Venus1 { public static void main(String args[]) { int[]x={1,2,3};
我有以下 PHP 脚本,现在我需要在 JavaScript 中做同样的事情。 JavaScript 中是否有类似于 PHP 函数的函数,我已经搜索了好几天但找不到类似的东西?我想做的是计算某个单词在数
这个问题在这里已经有了答案: Is it bad practice to specify an array size using a variable instead of `#define` in
我陷入了一种情况,我必须通过“选中”工具栏中的复选框来“选中”列表中存在的所有复选框。 这是创建复选框列表的代码:- itemTpl: 'checked="checked" /> {groupName
我正在使用Python3。在分析一些网站时,我遇到了一些奇怪的字符并寻找解决方案。我找到了一个,但在找到解决方案之前,我尝试了一些方法,并且知道我无法重置它。当我使用 Jupyter 笔记本将列表 l
我在 http 下有 unity android app 和 site api 的工作基础设施。 最近换了服务器,申请了ssl证书。现在我的 api 在 https 下。 在 unity 应用程序中,
我在 http 下有 unity android app 和 site api 的工作基础设施。 最近换了服务器,申请了ssl证书。现在我的 api 在 https 下。 在 unity 应用程序中,
我在 Objective-C 中有一些代码。我想,我收到了 NSString 类型,但是当我尝试将它保存在核心数据中时,我得到了一个 user.clientID = clientID; 错误,例如:
在表中我有一个名为 CallTime 的字段 (Varchar)。 包括晚上8:00、晚上8:40、上午10:00等时间 我想将字段类型更改为“时间”并更新时间格式。该怎么做? 谢谢 最佳答案 UPD
这个问题在这里已经有了答案: C# - for Loop Freezes at strange intervals (3 个答案) 关闭 6 年前。 我试图解决 problem #14 from P
我今天在 Pycharm 社区版 5.0.3 中收到了这个错误,想知道这是否只是我做错了/没有意识到,或者是 PyCharm lint 问题。重现错误的代码是 mylist = list() # fi
我的目标是将数据库中的随机文本显示到网页上。首先,我不知道为什么我的数据没有保存,为什么我得到的是[Entity of type sec.helloweb.HelloMessage with id:
我是一名优秀的程序员,十分优秀!