Final Feature 9c #10
|
|
@ -155,6 +155,7 @@ def apply_migration(filepath, filename):
|
|||
def run_migrations(migrations_dir="/app/migrations"):
|
||||
"""Run all pending migrations."""
|
||||
import glob
|
||||
import re
|
||||
|
||||
if not os.path.exists(migrations_dir):
|
||||
print("✓ No migrations directory found")
|
||||
|
|
@ -167,8 +168,10 @@ def run_migrations(migrations_dir="/app/migrations"):
|
|||
# Get already applied migrations
|
||||
applied = get_applied_migrations()
|
||||
|
||||
# Get all migration files
|
||||
migration_files = sorted(glob.glob(os.path.join(migrations_dir, "*.sql")))
|
||||
# Get all migration files (only numbered migrations like 001_*.sql)
|
||||
all_files = sorted(glob.glob(os.path.join(migrations_dir, "*.sql")))
|
||||
migration_pattern = re.compile(r'^\d{3}_.*\.sql$')
|
||||
migration_files = [f for f in all_files if migration_pattern.match(os.path.basename(f))]
|
||||
|
||||
if not migration_files:
|
||||
print("✓ No migration files found")
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user