Skip to content

Commit d2e25aa

Browse files
committed
fix: ensure we always clean dev migrations
fixes #195
1 parent ccdc188 commit d2e25aa

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/migration_generator/migration_generator.ex

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ defmodule AshSqlite.MigrationGenerator do
351351
352352
You have migrations remaining that were generated with the --dev flag.
353353
354-
Run `mix ash.codegen <name>` to remove the dev migraitons and replace them
355-
with production ready migrations.
354+
Run `mix ash.codegen <name>` to remove the dev migrations and replace them
355+
with production-ready migrations.
356356
""")
357357

358358
exit({:shutdown, 1})
@@ -2009,7 +2009,10 @@ defmodule AshSqlite.MigrationGenerator do
20092009
if File.exists?(snapshot_folder) do
20102010
snapshot_folder
20112011
|> File.ls!()
2012-
|> Enum.filter(&String.ends_with?(&1, ".json"))
2012+
|> Enum.filter(
2013+
&(String.match?(&1, ~r/^\d{14}\.json$/) or
2014+
(opts.dev and String.match?(&1, ~r/^\d{14}\_dev.json$/)))
2015+
)
20132016
|> case do
20142017
[] ->
20152018
get_old_snapshot(folder, snapshot)

0 commit comments

Comments
 (0)