MCPcopy Create free account
hub / github.com/dbt-labs/ade-bench / copy_migration_files

Function copy_migration_files

scripts_python/create_sandbox.py:186–213  ·  view source on GitHub ↗

Copy migration files to sandbox if migration_directory is specified.

(variant)

Source from the content-addressed store, hash-verified

184
185
186def copy_migration_files(variant):
187 """Copy migration files to sandbox if migration_directory is specified."""
188 if "migration_directory" not in variant:
189 return True # No migration directory specified, that's fine
190
191 migration_dir_name = variant["migration_directory"]
192 migration_dir_path = Path("shared/migrations") / migration_dir_name
193
194 if not migration_dir_path.exists():
195 print(f"Warning: Migration directory '{migration_dir_path}' not found")
196 return True # Not an error, just skip migration
197
198 sandbox_dir = Path("dev/sandbox")
199
200 # Copy migration.sh script to sandbox root
201 migration_script_path = migration_dir_path / "migration.sh"
202 if migration_script_path.exists():
203 if not copy_item(migration_script_path, sandbox_dir, "migration.sh script"):
204 return False
205
206 # Copy migration directory contents to sandbox/migration
207 migration_dest = sandbox_dir / "migrations"
208 return copy_item(
209 migration_dir_path,
210 migration_dest,
211 f"migration directory '{migration_dir_name}'",
212 create_dest_dir=True,
213 )
214
215
216def copy_shared_scripts():

Callers 1

mainFunction · 0.85

Calls 1

copy_itemFunction · 0.85

Tested by

no test coverage detected