feat: Add SQL script export option

- Added functionality to export the full database schema (CREATE statements) and data (INSERT statements) as a single `.sql` file.
- Created a new route `/export/database.sql` in `routes/export.py`.
- Added helper functions to `routes/export.py` (adapted from `sql_explorer`) to generate schema CREATE statements and data INSERT statements.
- Added a download link for the SQL export to the Settings page (`templates/settings.html`).
- Updated the changelog entry for data export to include the SQL option.
This commit is contained in:
Peter Stockings
2025-04-12 21:17:19 +10:00
parent 2d67badd32
commit 62e203bc2a
4 changed files with 283 additions and 0 deletions

2
app.py
View File

@@ -12,6 +12,7 @@ from routes.notes import notes_bp # Import the new notes blueprint
from routes.workout import workout_bp # Import the new workout blueprint
from routes.sql_explorer import sql_explorer_bp # Import the new SQL explorer blueprint
from routes.endpoints import endpoints_bp # Import the new endpoints blueprint
from routes.export import export_bp # Import the new export blueprint
from extensions import db
from utils import convert_str_to_date, generate_plot
from flask_htmx import HTMX
@@ -44,6 +45,7 @@ app.register_blueprint(notes_bp) # Register the notes blueprint
app.register_blueprint(workout_bp) # Register the workout blueprint
app.register_blueprint(sql_explorer_bp) # Register the SQL explorer blueprint (prefix defined in blueprint file)
app.register_blueprint(endpoints_bp) # Register the endpoints blueprint (prefix defined in blueprint file)
app.register_blueprint(export_bp) # Register the export blueprint (prefix defined in blueprint file)
@app.after_request
def response_minify(response):