Ticket #378 (closed defect: invalid)

Opened 6 years ago

Last modified 4 years ago

dashes in migration name causes South to not see them

Reported by: pauloswald@… Owned by: andrew
Priority: major Milestone: 0.7
Component: commands Version: 0.7-pre
Keywords: Cc:


While converting an existing app from South 0.6x to South 0.7pre I found that the migrate command would fail to see a migration with dashes in the name:

(hats)pitseleh:hats poswald$ ./manage.py migrate --list


(*) 0001_initial

(hats)pitseleh:hats poswald$ ls -al transact/migrations/
total 96
drwxr-xr-x 8 poswald admin 272 Mar 14 00:13 .
drwxr-xr-x 15 poswald admin 510 Mar 11 17:53 ..
-rw-r--r-- 1 poswald admin 350 Mar 11 17:43 0001_initial.py
-rw-r--r-- 1 poswald admin 1026 Mar 14 00:13 0001_initial.pyc
-rw-r--r-- 1 poswald admin 21612 Mar 11 17:43 0002_add-tx-acct.py
-rw-r--r-- 1 poswald admin 11494 Mar 11 17:58 0002_add-tx-acct.pyc
-rw-r--r-- 1 poswald admin 0 Mar 11 17:43 init.py
-rw-r--r-- 1 poswald admin 155 Mar 11 17:58 init.pyc

(hats)pitseleh:hats poswald$ mv transact/migrations/0002_add-tx-acct.py transact/migrations/0002_add_tx_acct.py

(hats)pitseleh:hats poswald$ ./manage.py migrate --list


(*) 0001_initial
( ) 0002_add_tx_acct

Change History

comment:1 Changed 6 years ago by andrew

  • Status changed from new to infoneeded
  • Milestone set to 0.7

That's correct, dashes are an invalid character for Python module names, so South's migration-listing regex will ignore those files.

How did you manage to create the migrations with dashes in the name? Most of South rejects invalid module names if you specify them.

comment:2 Changed 6 years ago by andrew

  • Status changed from infoneeded to closed
  • Resolution set to invalid

comment:3 Changed 5 years ago by anonymous

I have just encountered this issue when moving from 0.6.2 -> 0.7.2. We currently have migrations in production which have dashes in their names, while it might not be valid python, there are probably other people who have this issue. It would be nice to see some mention of it in documentation around naming of migrations? People *should* know better, but they don't and it is a regression from 0.6 -> 0.7, since it used to work without issue...

comment:4 Changed 5 years ago by andrew

South has always had a policy of explicit errors, and this is merely following that, unfortunately.

I've added a note to the 0.7 release notes, but this isn't really needed in the general 0.7 docs, as South now stops you creating files named this way.

Note: See TracTickets for help on using tickets.