22 lines
674 B
Python
22 lines
674 B
Python
import re
|
|
|
|
file_path = 'backend/src/db/migrations/1770016660721.js'
|
|
|
|
with open(file_path, 'r') as f:
|
|
content = f.read()
|
|
|
|
# Pattern to match the addColumn block for 'id'
|
|
# We use re.DOTALL so . matches newlines
|
|
# We look for 'id' as the second argument
|
|
pattern = r"\s*await queryInterface\.addColumn\(\s*'[^']+',\s*'id',\s*\{\s*type: Sequelize\.DataTypes\.INTEGER,.*?\},\s*\{ transaction \}\s*\);"
|
|
|
|
matches = re.findall(pattern, content, re.DOTALL)
|
|
print(f"Found {len(matches)} matches.")
|
|
for m in matches:
|
|
print("Match snippet:", m.strip()[:100])
|
|
|
|
new_content = re.sub(pattern, "", content, flags=re.DOTALL)
|
|
|
|
with open(file_path, 'w') as f:
|
|
f.write(new_content)
|