@@ -138,8 +138,15 @@ defmodule AshSqlite.MigrationGenerator do
138138 # Copied from ecto's mix task, thanks Ecto ❤️
139139 config = repo . config ( )
140140
141- app = Keyword . fetch! ( config , :otp_app )
142- Path . join ( [ Mix.Project . deps_paths ( ) [ app ] || File . cwd! ( ) , "priv" , "resource_snapshots" ] )
141+ if snapshot_path = config [ :snapshots_path ] do
142+ snapshot_path
143+ else
144+ priv =
145+ config [ :priv ] || "priv/#{ repo |> Module . split ( ) |> List . last ( ) |> Macro . underscore ( ) } "
146+
147+ app = Keyword . fetch! ( config , :otp_app )
148+ Application . app_dir ( app , Path . join ( priv , "resource_snapshots" ) )
149+ end
143150 end
144151
145152 defp create_extension_migrations ( repos , opts ) do
@@ -655,18 +662,18 @@ defmodule AshSqlite.MigrationGenerator do
655662 end
656663
657664 defp migration_path ( opts , repo ) do
658- repo_name = repo_name ( repo )
659665 # Copied from ecto's mix task, thanks Ecto ❤️
660666 config = repo . config ( )
661667 app = Keyword . fetch! ( config , :otp_app )
662668
663- if opts . migration_path do
664- opts . migration_path
669+ if path = opts . migration_path || config [ :tenant_migrations_path ] do
670+ path
665671 else
666- Path . join ( [ Mix.Project . deps_paths ( ) [ app ] || File . cwd! ( ) , "priv" ] )
672+ priv =
673+ config [ :priv ] || "priv/#{ repo |> Module . split ( ) |> List . last ( ) |> Macro . underscore ( ) } "
674+
675+ Application . app_dir ( app , Path . join ( priv , "migrations" ) )
667676 end
668- |> Path . join ( repo_name )
669- |> Path . join ( "migrations" )
670677 end
671678
672679 defp repo_name ( repo ) do
0 commit comments