Release 0.5.0: release candidate 1 #316

Merged
Jef Roosens merged 58 commits from release-0.5.0-rc.1 into main 2022-12-17 14:13:06 +01:00
2 changed files with 9 additions and 4 deletions
Showing only changes of commit e742d3de6d - Show all commits

View file

@ -84,6 +84,8 @@ pub fn (db &VieterDb) add_build_log(log BuildLog) int {
insert log into BuildLog insert log into BuildLog
} }
// Here, this does work because a log doesn't contain any foreign keys,
// meaning the ORM only has to do a single add
inserted_id := db.conn.last_id() as int inserted_id := db.conn.last_id() as int
return inserted_id return inserted_id

View file

@ -38,14 +38,17 @@ pub fn (db &VieterDb) get_target(target_id int) ?Target {
} }
// add_target inserts the given target into the database. // add_target inserts the given target into the database.
pub fn (db &VieterDb) add_target(repo Target) int { pub fn (db &VieterDb) add_target(target Target) int {
sql db.conn { sql db.conn {
insert repo into Target insert target into Target
} }
inserted_id := db.conn.last_id() as int // ID of inserted target is the largest id
inserted_target := sql db.conn {
select from Target order by id desc limit 1
}
return inserted_id return inserted_target.id
} }
// delete_target deletes the target with the given id from the database. // delete_target deletes the target with the given id from the database.