fix: content quality, image format, task monitor, calendar data source, search UI & sort
This commit is contained in:
@@ -53,6 +53,7 @@ def init_db():
|
||||
for table, col, typ in [
|
||||
("users", "org_id", "VARCHAR DEFAULT 'default'"),
|
||||
("topics", "org_id", "VARCHAR DEFAULT 'default'"),
|
||||
("topics", "reviewed_at", "TIMESTAMP"),
|
||||
("platform_configs", "requires_image", "BOOLEAN DEFAULT FALSE"),
|
||||
("platform_configs", "image_count_min", "INTEGER DEFAULT 0"),
|
||||
("platform_configs", "image_count_max", "INTEGER DEFAULT 0"),
|
||||
@@ -82,6 +83,7 @@ def init_db():
|
||||
("prompt_configs", "temperature", "FLOAT"),
|
||||
("prompt_configs", "max_tokens", "INTEGER"),
|
||||
("prompt_configs", "created_by", "VARCHAR"),
|
||||
("search_providers", "console_url", "VARCHAR"),
|
||||
("keyword_domain_map", "id", "INTEGER PRIMARY KEY"),
|
||||
("keyword_domain_map", "pattern", "VARCHAR"),
|
||||
("keyword_domain_map", "domain", "VARCHAR"),
|
||||
@@ -124,10 +126,11 @@ def init_db():
|
||||
conn.execute(text(f"ALTER TABLE {table} ADD COLUMN {col} {typ}"))
|
||||
except Exception:
|
||||
pass
|
||||
# Create roles and menus tables if they don't exist
|
||||
# Create roles, menus, and search_providers tables if they don't exist
|
||||
for tbl_sql in [
|
||||
"CREATE TABLE IF NOT EXISTS roles (id SERIAL PRIMARY KEY, name VARCHAR UNIQUE NOT NULL, description VARCHAR DEFAULT '', is_system BOOLEAN DEFAULT FALSE, created_at TIMESTAMP WITH TIME ZONE DEFAULT now())",
|
||||
"CREATE TABLE IF NOT EXISTS menus (id SERIAL PRIMARY KEY, parent_id INTEGER REFERENCES menus(id), name VARCHAR NOT NULL, path VARCHAR NOT NULL, icon VARCHAR DEFAULT '', sort_order INTEGER DEFAULT 0, roles JSON DEFAULT '[]'::json, is_active BOOLEAN DEFAULT TRUE, created_at TIMESTAMP WITH TIME ZONE DEFAULT now())",
|
||||
"CREATE TABLE IF NOT EXISTS search_providers (id SERIAL PRIMARY KEY, name VARCHAR NOT NULL, provider_type VARCHAR NOT NULL, api_key VARCHAR, api_url VARCHAR, priority INTEGER DEFAULT 1, enabled BOOLEAN DEFAULT TRUE, daily_limit INTEGER DEFAULT 1500, usage_today INTEGER DEFAULT 0, extra_config JSON DEFAULT '{}'::json, last_used_at TIMESTAMP, created_at TIMESTAMP WITH TIME ZONE DEFAULT now(), updated_at TIMESTAMP WITH TIME ZONE DEFAULT now())",
|
||||
]:
|
||||
try:
|
||||
conn.execute(text(tbl_sql))
|
||||
|
||||
Reference in New Issue
Block a user