Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
aisbf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexlab
aisbf
Commits
b2fd5908
Commit
b2fd5908
authored
Apr 21, 2026
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add migration for user_cache_settings table
parent
9539a032
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
database.py
aisbf/database.py
+42
-0
No files found.
aisbf/database.py
View file @
b2fd5908
...
...
@@ -3968,6 +3968,48 @@ def DatabaseManager__run_config_migrations(self, cursor, auto_increment, timesta
# ==============================================
logger
.
info
(
"Running database migrations..."
)
# Migration: Create user_cache_settings table if missing
try
:
if
self
.
db_type
==
'sqlite'
:
cursor
.
execute
(
"PRAGMA table_info(user_cache_settings)"
)
if
not
cursor
.
fetchall
():
cursor
.
execute
(
f
'''
CREATE TABLE user_cache_settings (
id INTEGER PRIMARY KEY {auto_increment},
user_id INTEGER NOT NULL,
provider_id VARCHAR(255),
model_name VARCHAR(255),
cache_enabled {boolean_type} DEFAULT 1,
created_at TIMESTAMP DEFAULT {timestamp_default},
updated_at TIMESTAMP DEFAULT {timestamp_default},
FOREIGN KEY (user_id) REFERENCES users(id),
UNIQUE(user_id, provider_id, model_name)
)
'''
)
logger
.
info
(
"✅ Migration: Created user_cache_settings table"
)
else
:
cursor
.
execute
(
"""
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'user_cache_settings'
"""
)
if
not
cursor
.
fetchone
():
cursor
.
execute
(
f
'''
CREATE TABLE user_cache_settings (
id INTEGER PRIMARY KEY {auto_increment},
user_id INTEGER NOT NULL,
provider_id VARCHAR(255),
model_name VARCHAR(255),
cache_enabled {boolean_type} DEFAULT 1,
created_at TIMESTAMP DEFAULT {timestamp_default},
updated_at TIMESTAMP DEFAULT {timestamp_default},
FOREIGN KEY (user_id) REFERENCES users(id),
UNIQUE(user_id, provider_id, model_name)
)
'''
)
logger
.
info
(
"✅ Migration: Created user_cache_settings table"
)
except
Exception
as
e
:
logger
.
warning
(
f
"Migration check for user_cache_settings table: {e}"
)
# Migration: Create account_tiers table if missing
try
:
if
self
.
db_type
==
'sqlite'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment