Skip to content

Commit 373289e

Browse files
authored
fix bug when user enters an empty string (#992)
1 parent 919983a commit 373289e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

piccolo/apps/migrations/commands/backwards.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,11 @@ async def run_migrations_backwards(self, app_config: AppConfig):
7878
_continue = (
7979
"y"
8080
if self.auto_agree
81-
else input(f"Reverse {n} migration{'s' if n != 1 else ''}? [y/N] ")
81+
else input(
82+
f"Reverse {n} migration{'s' if n != 1 else ''}? [y/N] "
83+
).lower()
8284
)
83-
if _continue in "yY":
85+
if _continue == "y":
8486
for migration_id in reversed_migration_ids:
8587
migration_module = migration_modules[migration_id]
8688
response = await migration_module.forwards()
@@ -131,10 +133,10 @@ async def run_backwards(
131133
"apps:\n"
132134
f"{', '.join(names)}\n"
133135
"Are you sure you want to continue? [y/N] "
134-
)
136+
).lower()
135137
)
136138

137-
if _continue not in "yY":
139+
if _continue != "y":
138140
return MigrationResult(success=False, message="user cancelled")
139141
for _app_name in sorted_app_names:
140142
print_heading(_app_name)

0 commit comments

Comments
 (0)