Skip to content

Commit 79d6635

Browse files
committed
raise ValueError when creating migration with path None
1 parent 99339ee commit 79d6635

File tree

1 file changed

+6
-4
lines changed
  • piccolo/apps/migrations/commands

1 file changed

+6
-4
lines changed

piccolo/apps/migrations/commands/new.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,12 @@ def _generate_migration_meta(app_config: AppConfig) -> NewMigrationMeta:
9898

9999
filename = f"{cleaned_app_name}_{cleaned_id}"
100100

101-
if app_config.resolved_migrations_folder_path:
102-
path = os.path.join(
103-
app_config.resolved_migrations_folder_path, f"{filename}.py"
104-
)
101+
if app_config.resolved_migrations_folder_path is None:
102+
raise ValueError("Migrations disabled in this app!")
103+
104+
path = os.path.join(
105+
app_config.resolved_migrations_folder_path, f"{filename}.py"
106+
)
105107

106108
return NewMigrationMeta(
107109
migration_id=_id, migration_filename=filename, migration_path=path

0 commit comments

Comments
 (0)