Modify ↓
Ticket #1192 (new defect)
Opened 6 months ago
migration fails for sqlite if TextField default value contains a percentage sign
| Reported by: | mrooney.south@… | Owned by: | andrew |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | migrations | Version: | 0.7.6 |
| Keywords: | Cc: |
Description
Using South 0.7.6 / Python 2.7.3 / Django 1.4.2, I created a model field like:
email_body = models.TextField?(default="Please download your free report: %LINK%")
another_field = models.BooleanField?(default=False)
A schemamigration --auto successfully created a migration, and did end up creating an email_body column, but will fail trying to create the next "another_field" migration, whatever it may be.
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/michaelrooney/Code/nyr/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/Users/michaelrooney/Code/nyr/env/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/michaelrooney/Code/nyr/env/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/michaelrooney/Code/nyr/env/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
output = self.handle(*args, **options)
File "/Users/michaelrooney/Code/nyr/env/lib/python2.7/site-packages/south/management/commands/migrate.py", line 108, in handle
ignore_ghosts = ignore_ghosts,
File "/Users/michaelrooney/Code/nyr/env/lib/python2.7/site-packages/south/migration/__init__.py", line 213, in migrate_app
success = migrator.migrate_many(target, workplan, database)
File "/Users/michaelrooney/Code/nyr/env/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/michaelrooney/Code/nyr/env/lib/python2.7/site-packages/south/migration/migrators.py", line 310, in migrate_many
result = self.migrate(migration, database)
File "/Users/michaelrooney/Code/nyr/env/lib/python2.7/site-packages/south/migration/migrators.py", line 133, in migrate
result = self.run(migration)
File "/Users/michaelrooney/Code/nyr/env/lib/python2.7/site-packages/south/migration/migrators.py", line 107, in run
return self.run_migration(migration)
File "/Users/michaelrooney/Code/nyr/env/lib/python2.7/site-packages/south/migration/migrators.py", line 81, in run_migration
migration_function()
File "/Users/michaelrooney/Code/nyr/env/lib/python2.7/site-packages/south/migration/migrators.py", line 57, in <lambda>
return (lambda: direction(orm))
File "/Users/michaelrooney/Code/nyr/website/nyr/migrations/0005_auto__add_field_developmenttranslation_email_subject__add_field_develo.py", line 14, in forwards
keep_default=False)
File "/Users/michaelrooney/Code/nyr/env/lib/python2.7/site-packages/south/db/sqlite3.py", line 31, in add_column
field.column: self._column_sql_for_create(table_name, name, field, False),
File "/Users/michaelrooney/Code/nyr/env/lib/python2.7/site-packages/south/db/generic.py", line 44, in _cache_clear
return func(self, table, *args, **opts)
File "/Users/michaelrooney/Code/nyr/env/lib/python2.7/site-packages/south/db/sqlite3.py", line 103, in _remake_table
", ".join(["%s %s" % (self.quote_name(cname), ctype) for cname, ctype in definitions.items()]),
File "/Users/michaelrooney/Code/nyr/env/lib/python2.7/site-packages/south/db/generic.py", line 273, in execute
cursor.execute(sql, params)
File "/Users/michaelrooney/Code/nyr/env/lib/python2.7/site-packages/django/db/backends/util.py", line 44, in execute
sql = self.db.ops.last_executed_query(self.cursor, sql, params)
File "/Users/michaelrooney/Code/nyr/env/lib/python2.7/site-packages/django/db/backends/__init__.py", line 603, in last_executed_query
return smart_unicode(sql) % u_params
TypeError: not enough arguments for format string
Attachments
Note: See
TracTickets for help on using
tickets.
