-
Notifications
You must be signed in to change notification settings - Fork 0
DB fixes #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DB fixes #40
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,107 @@ | ||||||||||||||||||||||||
| #!/usr/bin/env python3 | ||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||
| Database initialization script for Subscription Tracker | ||||||||||||||||||||||||
| Ensures database is created with proper permissions and structure | ||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| import os | ||||||||||||||||||||||||
| import sys | ||||||||||||||||||||||||
| import stat | ||||||||||||||||||||||||
| from pathlib import Path | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # Add the app directory to Python path | ||||||||||||||||||||||||
| sys.path.insert(0, '/app') | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| def check_database_permissions(): | ||||||||||||||||||||||||
| """Check and fix database file permissions""" | ||||||||||||||||||||||||
| instance_dir = Path('/app/instance') | ||||||||||||||||||||||||
|
Comment on lines
+13
to
+17
|
||||||||||||||||||||||||
| sys.path.insert(0, '/app') | |
| def check_database_permissions(): | |
| """Check and fix database file permissions""" | |
| instance_dir = Path('/app/instance') | |
| APP_HOME = os.environ.get('APP_HOME', str(Path(__file__).resolve().parent)) | |
| sys.path.insert(0, APP_HOME) | |
| def check_database_permissions(): | |
| """Check and fix database file permissions""" | |
| instance_dir = Path(APP_HOME) / 'instance' |
Copilot
AI
Oct 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The execute() method is deprecated in SQLAlchemy 2.0+. Use db.session.execute() instead to avoid compatibility issues.
| result = db.engine.execute(db.text("SELECT 1 as test")) | |
| result = db.session.execute(db.text("SELECT 1 as test")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pattern matching logic is fragile and could match unintended commands. Consider using a more explicit check like
case "$1" inwith specific command patterns or checking the actual command name.