mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-02-02 05:53:15 -05:00
feature/additional-db (#371)
* add support for setting db_url * fix tests * add db_username/password env variables * init db if super user doesn't exist * fix tests * fix tests * set SQLite default DB_URL * don't run tests on draft PRs * add lint/black tests * add test-all * spell check settings * black/flake8 * check format fail * new badges * rename workflow * fix formatting * remove white-space * test connection arguments for pg * format * add new values to template * format * remove old script * monkeypatch test db * working docker-compose for postgres * update docs * test pg workflow * format * add driver * install w/ poetry * setup container * change image * set database to localhost * update tests * set url * fix url path * disable cache * database init * bust cache * get by name Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
@@ -2,7 +2,7 @@ from mealie.core import root_logger
|
||||
from mealie.core.config import settings
|
||||
from mealie.core.security import get_password_hash
|
||||
from mealie.db.database import db
|
||||
from mealie.db.db_setup import create_session, sql_exists
|
||||
from mealie.db.db_setup import create_session
|
||||
from mealie.schema.settings import SiteSettings
|
||||
from mealie.schema.theme import SiteTheme
|
||||
from sqlalchemy.orm import Session
|
||||
@@ -51,7 +51,9 @@ def default_user_init(session: Session):
|
||||
|
||||
|
||||
def main():
|
||||
if sql_exists:
|
||||
session = create_session()
|
||||
init_user = db.users.get(session, "1", "id")
|
||||
if init_user:
|
||||
print("Database Exists")
|
||||
else:
|
||||
print("Database Doesn't Exists, Initializing...")
|
||||
|
||||
Reference in New Issue
Block a user