Skip to content
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

Log output from database scripts need improved, they're giving false information #219

Closed
boc-the-git opened this issue Jul 23, 2024 · 1 comment

Comments

@boc-the-git
Copy link
Contributor

Take this for instance:

logging.info("Creating EmailSettings table...")
try:
cursor.execute("""
CREATE TABLE IF NOT EXISTS "EmailSettings" (
EmailSettingsID SERIAL PRIMARY KEY,
Server_Name VARCHAR(255),
Server_Port INT,
From_Email VARCHAR(255),
Send_Mode VARCHAR(255),
Encryption VARCHAR(255),
Auth_Required BOOLEAN,
Username VARCHAR(255),
Password VARCHAR(255)
)
""")
logging.info("EmailSettings table created successfully.")

It tells me on every container start that it has created the table, when in fact it hasn't.

Some other examples (not an exhaustive list!):

cursor.execute("""
INSERT INTO "Users" (Fullname, Username, Email, Hashed_PW, IsAdmin)
VALUES (%s, %s, %s, %s, %s)
ON CONFLICT (Username) DO NOTHING
""", ('Background Tasks', 'bt', 'inactive', hashed_password, False))
logging.info("Added new 'bt' user.")

logging.info("created default admin.")

try:
cursor.execute("""CREATE TABLE IF NOT EXISTS "UserSettings" (
UserSettingID SERIAL PRIMARY KEY,
UserID INT UNIQUE,
Theme VARCHAR(255) DEFAULT 'nordic',
FOREIGN KEY (UserID) REFERENCES "Users"(UserID)
)""")
except Exception as e:
print(f"Error adding UserSettings table: {e}")
logging.info("created UserSettings table.")

@madeofpendletonwool
Copy link
Owner

You're absolutely right. Lot of this is leftover remnants from testing. I went ahead and cleaned it all up. Messaged output from startup should be much more clear now in #232. This will release as part of 0.6.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants