feat: 添加跳板机功能
This commit is contained in:
@@ -283,7 +283,20 @@ const definedMigrations: Migration[] = [
|
||||
updated_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
|
||||
);
|
||||
`
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: 'Add jump_chain and proxy_type columns to connections table',
|
||||
sql: `
|
||||
ALTER TABLE connections ADD COLUMN jump_chain TEXT NULL;
|
||||
ALTER TABLE connections ADD COLUMN proxy_type TEXT NULL;
|
||||
`,
|
||||
check: async (db: Database): Promise<boolean> => {
|
||||
const jumpChainColumnExists = await columnExists(db, 'connections', 'jump_chain');
|
||||
const proxyTypeColumnExists = await columnExists(db, 'connections', 'proxy_type');
|
||||
return !jumpChainColumnExists || !proxyTypeColumnExists;
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,15 +18,7 @@ CREATE TABLE IF NOT EXISTS audit_logs (
|
||||
);
|
||||
`;
|
||||
|
||||
// Removed API Keys table definition
|
||||
// export const createApiKeysTableSQL = `
|
||||
// CREATE TABLE IF NOT EXISTS api_keys (
|
||||
// id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
// name TEXT NOT NULL,
|
||||
// hashed_key TEXT UNIQUE NOT NULL,
|
||||
// created_at INTEGER NOT NULL
|
||||
// );
|
||||
// `;
|
||||
|
||||
|
||||
// Passkeys table definition
|
||||
export const createPasskeysTableSQL = `
|
||||
@@ -101,13 +93,15 @@ CREATE TABLE IF NOT EXISTS connections (
|
||||
encrypted_private_key TEXT NULL,
|
||||
encrypted_passphrase TEXT NULL,
|
||||
proxy_id INTEGER NULL,
|
||||
ssh_key_id INTEGER NULL, -- 新增 ssh_key_id 列
|
||||
ssh_key_id INTEGER NULL,
|
||||
notes TEXT NULL,
|
||||
created_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
|
||||
jump_chain TEXT NULL,
|
||||
proxy_type TEXT NULL,
|
||||
created_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
|
||||
updated_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
|
||||
last_connected_at INTEGER NULL,
|
||||
FOREIGN KEY (proxy_id) REFERENCES proxies(id) ON DELETE SET NULL,
|
||||
FOREIGN KEY (ssh_key_id) REFERENCES ssh_keys(id) ON DELETE SET NULL -- 新增外键约束
|
||||
FOREIGN KEY (ssh_key_id) REFERENCES ssh_keys(id) ON DELETE SET NULL
|
||||
);
|
||||
`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user