Skip to content

Commit f736c56

Browse files
committed
changing migration filenames, for Windows support
1 parent 550f02d commit f736c56

File tree

6 files changed

+8
-1
lines changed

6 files changed

+8
-1
lines changed

piccolo/apps/migrations/commands/new.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,14 @@ async def _create_new_migration(app_config: AppConfig, auto=False) -> None:
5757
Creates a new migration file on disk.
5858
"""
5959
_id = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S")
60-
path = os.path.join(app_config.migrations_folder_path, f"{_id}.py")
60+
61+
# Originally we just used the _id as the filename, but colons aren't
62+
# supported in Windows, so we need to sanitize it. We don't want to
63+
# change the _id format though, as it would break existing migrations.
64+
# The filename doesn't have any special significance - only the id matters.
65+
filename = _id.replace(":", "-")
66+
67+
path = os.path.join(app_config.migrations_folder_path, f"{filename}.py")
6168

6269
if auto:
6370
alter_statements = await AutoMigrationManager().get_alter_statements(

piccolo/apps/user/piccolo_migrations/2019-11-14T21:52:21.py renamed to piccolo/apps/user/piccolo_migrations/2019-11-14T21-52-21.py

File renamed without changes.

piccolo/apps/user/piccolo_migrations/2020-06-11T21:38:55.py renamed to piccolo/apps/user/piccolo_migrations/2020-06-11T21-38-55.py

File renamed without changes.

tests/example_app/piccolo_migrations/2020-12-17T18:44:30.py renamed to tests/example_app/piccolo_migrations/2020-12-17T18-44-30.py

File renamed without changes.

tests/example_app/piccolo_migrations/2020-12-17T18:44:39.py renamed to tests/example_app/piccolo_migrations/2020-12-17T18-44-39.py

File renamed without changes.

tests/example_app/piccolo_migrations/2020-12-17T18:44:44.py renamed to tests/example_app/piccolo_migrations/2020-12-17T18-44-44.py

File renamed without changes.

0 commit comments

Comments
 (0)