diff --git a/src/db.ts b/src/db.ts index f5b71f0..956cde7 100644 --- a/src/db.ts +++ b/src/db.ts @@ -728,6 +728,7 @@ export class Store { ['email_job_updates', 'INTEGER NOT NULL DEFAULT 1'], ['email_daily_digest', 'INTEGER NOT NULL DEFAULT 1'], ['notify_email', 'TEXT'], + ['allow_private_models', 'INTEGER NOT NULL DEFAULT 0'], ['github_token_scopes', 'TEXT'], ] for (const [name, type] of additions) { @@ -747,7 +748,6 @@ export class Store { ['allow_paths', "TEXT NOT NULL DEFAULT ''"], ['deny_paths', "TEXT NOT NULL DEFAULT ''"], ['merge_method', "TEXT NOT NULL DEFAULT 'squash'"], - ['allow_private_models', 'INTEGER NOT NULL DEFAULT 0'], ['require_protection', 'INTEGER NOT NULL DEFAULT 1'], ['stage_mode', "TEXT NOT NULL DEFAULT 'off'"], ['models_dirty', 'INTEGER NOT NULL DEFAULT 0'], diff --git a/test/db.test.ts b/test/db.test.ts index fe65889..040f428 100644 --- a/test/db.test.ts +++ b/test/db.test.ts @@ -371,3 +371,15 @@ test('repository bot model assignments persist and are cleaned with the selectio store.close() } }) + +test('the per-user private model permission persists', () => { + const store = new Store(':memory:') + try { + const user = makeUser(store, { login: 'private-permission-user', status: 'approved' }) + assert.equal(store.userById(user.id)?.allow_private_models, 0) + store.setUserAllowPrivateModels(user.id, true) + assert.equal(store.userById(user.id)?.allow_private_models, 1) + } finally { + store.close() + } +})