-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
493 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: run | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
paths: | ||
- "go.*" | ||
- "**/*.go" | ||
- ".github/workflows/*.yml" | ||
|
||
permissions: | ||
contents: read | ||
|
||
env: | ||
GO_VERSION: '1.22.5' | ||
|
||
jobs: | ||
run: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- name: build | ||
run: go build . | ||
- name: run | ||
run: | | ||
cat assets/sample-tasks.txt | ./omm import | ||
./omm 'test: a task' | ||
./omm tasks | ||
./.github/scripts/checknumtasks.sh "$(./omm tasks | wc -l | xargs)" 11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package persistence | ||
|
||
import ( | ||
"database/sql" | ||
"time" | ||
) | ||
|
||
func InitDB(db *sql.DB) error { | ||
// these init queries cannot be changed once omm is released; only further | ||
// migrations can be added, which are run when omm sees a difference between | ||
// the values in the db_versions table and latestDBVersion | ||
_, err := db.Exec(` | ||
CREATE TABLE IF NOT EXISTS db_versions ( | ||
id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
version INTEGER NOT NULL, | ||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP | ||
); | ||
CREATE TABLE IF NOT EXISTS task ( | ||
id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
summary TEXT NOT NULL, | ||
active BOOLEAN NOT NULL DEFAULT true, | ||
created_at TIMESTAMP NOT NULL, | ||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP | ||
); | ||
CREATE TABLE task_sequence ( | ||
id INTEGER PRIMARY KEY, | ||
sequence JSON NOT NULL | ||
); | ||
INSERT INTO task_sequence (id, sequence) VALUES (1, '[]'); | ||
INSERT INTO db_versions (version, created_at) | ||
VALUES (1, ?); | ||
`, time.Now().UTC()) | ||
|
||
return err | ||
} |
Oops, something went wrong.