diff --git a/connector/shared/src/commonMain/sqldelight/io/anthonyberg/connector/shared/database/ActionResult.sq b/connector/shared/src/commonMain/sqldelight/io/anthonyberg/connector/shared/database/ActionResult.sq new file mode 100644 index 0000000..1c95442 --- /dev/null +++ b/connector/shared/src/commonMain/sqldelight/io/anthonyberg/connector/shared/database/ActionResult.sq @@ -0,0 +1,20 @@ +CREATE TABLE ActionResult ( + id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, + testId INTEGER NOT NULL, + actionId INTEGER NOT NULL, + initState TEXT NOT NULL, + endState TEXT, + startUTC TEXT NOT NULL, + endUTC TEXT, + FOREIGN KEY (testId) REFERENCES Test(id), + FOREIGN KEY (actionId) REFERENCES Action(id) +); + +startResult: +INSERT INTO ActionResult(testId, actionId, initState, startUTC) +VALUES (?, ?, ?, ?); + +finishResult: +UPDATE ActionResult +SET endState = ?, endUTC = ? +WHERE id = ?; diff --git a/connector/shared/src/commonMain/sqldelight/io/anthonyberg/connector/shared/database/Test.sq b/connector/shared/src/commonMain/sqldelight/io/anthonyberg/connector/shared/database/Test.sq new file mode 100644 index 0000000..8a7bfff --- /dev/null +++ b/connector/shared/src/commonMain/sqldelight/io/anthonyberg/connector/shared/database/Test.sq @@ -0,0 +1,16 @@ +CREATE TABLE Test ( + id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, + procedureId INTEGER NOT NULL, + startUTC TEXT NOT NULL, + endUTC TEXT, + FOREIGN KEY (procedureId) REFERENCES Procedure(id) +); + +startTest: +INSERT INTO Test(procedureId, startUTC) +VALUES (?, ?); + +endTest: +UPDATE Test +SET endUTC = ? +WHERE id = ?;