Closed yoowon90 closed 4 months ago
Created database_dev.db and database_prod.db. Flask uses ports 5000 and 5001, respectively. Have not tested ORM Models (not sure what it is or if it is needed). Have not tested merging according to ChatGPT's advice:
Handle Missing Columns: Ensure that your application code gracefully handles missing columns when querying database_prod.
Use SQLAlchemy's Column object with nullable=True for new columns that may not exist in database_prod. Use try-except blocks or conditionals (hasattr()) to check for the existence of columns before accessing them. python sample code
try:
# Example query in prod environment
result = ModelProd.query.filter_by(id=1).first()
if result and hasattr(result, 'new_column'):
# Process if the new column exists
else:
# Handle case where new column doesn't exist
except Exception as e:
# Handle exceptions gracefully
print(f"Error: {e}")
Separate ports based on from which branch application is run