fix migrations hopefully
This commit is contained in:
@@ -7,17 +7,31 @@ while ! nc -z db 5432; do
|
||||
done
|
||||
echo "Database is ready!"
|
||||
|
||||
# Initialize the database
|
||||
# Initialize migrations if they don't exist
|
||||
if [ ! -d "migrations" ]; then
|
||||
echo "Initializing database migrations..."
|
||||
flask db init
|
||||
fi
|
||||
|
||||
# Create and apply migrations
|
||||
echo "Creating and applying database migrations..."
|
||||
flask db migrate -m "Initial migration"
|
||||
flask db upgrade
|
||||
|
||||
# Create default site settings if they don't exist
|
||||
echo "Creating default site settings..."
|
||||
python3 -c "
|
||||
from app import create_app
|
||||
from models import SiteSettings, db
|
||||
app = create_app()
|
||||
with app.app_context():
|
||||
SiteSettings.get_settings()
|
||||
try:
|
||||
settings = SiteSettings.get_settings()
|
||||
print('Default site settings created successfully')
|
||||
except Exception as e:
|
||||
print(f'Error creating site settings: {e}')
|
||||
"
|
||||
|
||||
# Start the application
|
||||
echo "Starting application..."
|
||||
exec gunicorn --bind 0.0.0.0:5000 app:app
|
||||
Reference in New Issue
Block a user