mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-07 00:14:25 +00:00
Update handlers and db
This commit is contained in:
@@ -27,8 +27,8 @@ func TestMigrate(t *testing.T) {
|
||||
t.Fatalf("failed to get migration version: %v", err)
|
||||
}
|
||||
|
||||
if version != 2 { // Current number of migrations in production code
|
||||
t.Errorf("expected migration version 2, got %d", version)
|
||||
if version != 1 { // Current number of migrations in production code
|
||||
t.Errorf("expected migration version 1, got %d", version)
|
||||
}
|
||||
|
||||
// Verify number of migration entries matches versions applied
|
||||
@@ -38,8 +38,8 @@ func TestMigrate(t *testing.T) {
|
||||
t.Fatalf("failed to count migrations: %v", err)
|
||||
}
|
||||
|
||||
if count != 2 {
|
||||
t.Errorf("expected 2 migration entries, got %d", count)
|
||||
if count != 1 {
|
||||
t.Errorf("expected 1 migration entries, got %d", count)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -82,8 +82,8 @@ func TestMigrate(t *testing.T) {
|
||||
t.Fatalf("failed to count migrations: %v", err)
|
||||
}
|
||||
|
||||
if count != 2 {
|
||||
t.Errorf("expected 2 migration entries, got %d", count)
|
||||
if count != 1 {
|
||||
t.Errorf("expected 1 migration entries, got %d", count)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -118,8 +118,8 @@ func TestMigrate(t *testing.T) {
|
||||
t.Fatalf("failed to get migration version: %v", err)
|
||||
}
|
||||
|
||||
if version != 2 {
|
||||
t.Errorf("expected migration version to remain at 2, got %d", version)
|
||||
if version != 1 {
|
||||
t.Errorf("expected migration version to remain at 1, got %d", version)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -68,12 +68,14 @@ func (db *database) createWorkspaceTx(tx *sql.Tx, workspace *models.Workspace) e
|
||||
user_id, name,
|
||||
theme, auto_save, show_hidden_files,
|
||||
git_enabled, git_url, git_user, git_token,
|
||||
git_auto_commit, git_commit_msg_template
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
git_auto_commit, git_commit_msg_template,
|
||||
git_commit_name, git_commit_email
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
workspace.UserID, workspace.Name,
|
||||
workspace.Theme, workspace.AutoSave, workspace.ShowHiddenFiles,
|
||||
workspace.GitEnabled, workspace.GitURL, workspace.GitUser, workspace.GitToken,
|
||||
workspace.GitAutoCommit, workspace.GitCommitMsgTemplate,
|
||||
workspace.GitCommitName, workspace.GitCommitEmail,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -23,7 +23,8 @@ func (db *database) CreateWorkspace(workspace *models.Workspace) error {
|
||||
INSERT INTO workspaces (
|
||||
user_id, name, theme, auto_save, show_hidden_files,
|
||||
git_enabled, git_url, git_user, git_token,
|
||||
git_auto_commit, git_commit_msg_template, git_commit_name, git_commit_email
|
||||
git_auto_commit, git_commit_msg_template,
|
||||
git_commit_name, git_commit_email
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
workspace.UserID, workspace.Name, workspace.Theme, workspace.AutoSave, workspace.ShowHiddenFiles,
|
||||
workspace.GitEnabled, workspace.GitURL, workspace.GitUser, encryptedToken,
|
||||
@@ -51,7 +52,8 @@ func (db *database) GetWorkspaceByID(id int) (*models.Workspace, error) {
|
||||
id, user_id, name, created_at,
|
||||
theme, auto_save, show_hidden_files,
|
||||
git_enabled, git_url, git_user, git_token,
|
||||
git_auto_commit, git_commit_msg_template, git_commit_name, git_commit_email
|
||||
git_auto_commit, git_commit_msg_template,
|
||||
git_commit_name, git_commit_email
|
||||
FROM workspaces
|
||||
WHERE id = ?`,
|
||||
id,
|
||||
@@ -93,7 +95,8 @@ func (db *database) GetWorkspaceByName(userID int, workspaceName string) (*model
|
||||
&workspace.ID, &workspace.UserID, &workspace.Name, &workspace.CreatedAt,
|
||||
&workspace.Theme, &workspace.AutoSave, &workspace.ShowHiddenFiles,
|
||||
&workspace.GitEnabled, &workspace.GitURL, &workspace.GitUser, &encryptedToken,
|
||||
&workspace.GitAutoCommit, &workspace.GitCommitMsgTemplate, &workspace.GitCommitName, &workspace.GitCommitEmail,
|
||||
&workspace.GitAutoCommit, &workspace.GitCommitMsgTemplate,
|
||||
&workspace.GitCommitName, &workspace.GitCommitEmail,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user