Not sure if this is considered a bug, but the SQL output from sqlmigrate 
contains a small syntax error with default string values:

Add a new column as so:
class City(models.Model):
    ...
    name = models.CharField(max_length=100, default='a b c d')

Create migration, and run sqlmigrate command:
BEGIN;
--
-- Add field name to city
--
ALTER TABLE `map_city` ADD COLUMN `name ` varchar(100) DEFAULT a b c d NOT 
NULL;
ALTER TABLE `map_city` ALTER COLUMN `name ` DROP DEFAULT;
COMMIT;

Notice 'a b c d' is missing quotes. When this migration is actually applied 
it runs through cursor.execute, which properly quotes the value.

I realize sqlmigrate is only for getting a preview of the SQL, but other 
parts like the table name and columns are correctly quoted, so why not the 
default?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/666712e2-1fad-49c1-8885-8296c040f491%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to