Skip to content

Commit

Permalink
fix(sql): important SQL fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nickersoft committed Jan 12, 2024
1 parent b399bdd commit 82538a0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/sql/examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type EXAMPLES struct {
ID sq.StringField `ddl:"primarykey"`
TEXT sq.StringField `ddl:"notnull"`
DEFINITION_ID sq.UUIDField `ddl:"references=definitions.id"`
NOTE_ID sq.UUIDField `ddl:"references=definitions.id"`
NOTE_ID sq.UUIDField `ddl:"references=notes.id"`
}

// Insert examples w/ relation to current definition
Expand Down
2 changes: 1 addition & 1 deletion lib/sql/notes.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ func insertNotes(builder *SQLBuilder, definitionID string, notes []types.NoteRep
),
)

insertExamples(builder, "", note.ID, note.Examples)
insertExamples(builder, "", id, note.Examples)
}
}
4 changes: 2 additions & 2 deletions lib/sql/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func createSchema(dialect SQLDialect) (string, error) {
"senses.go",
"groups.go",
"definitions.go",
"examples.go",
"notes.go",
"examples.go",
},
DryRun: true,
Stdout: &buf,
Expand Down Expand Up @@ -68,5 +68,5 @@ func DictionaryToSQL(dict types.DictionaryRepresentable, dialect SQLDialect, inc
cmds = append([]string{schema}, cmds...)
}

return strings.Join(cmds, ";\n\n"), nil
return strings.Join(cmds, ";\n\n") + ";", nil
}

0 comments on commit 82538a0

Please sign in to comment.