-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: drop mongodb for sqlite to limit the amount of needed containers
- Loading branch information
Showing
14 changed files
with
162 additions
and
164 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -187,4 +187,5 @@ cython_debug/ | |
|
||
.next | ||
|
||
configs/* | ||
configs/* | ||
data |
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,3 @@ | ||
from .startup import create_database | ||
|
||
__all__ = ["create_database"] |
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,29 @@ | ||
import sqlite3 | ||
import os | ||
|
||
DATA_FOLDER = "./data" | ||
DATABASE_PATH = f"{DATA_FOLDER}/jobs.db" | ||
|
||
|
||
def create_database(): | ||
os.makedirs(DATA_FOLDER, exist_ok=True) | ||
conn = sqlite3.connect(DATABASE_PATH) | ||
create_tables(conn) | ||
conn.close() | ||
|
||
|
||
def create_tables(conn: sqlite3.Connection): | ||
cursor = conn.cursor() | ||
_ = cursor.execute( | ||
""" | ||
CREATE TABLE IF NOT EXISTS jobs ( | ||
id TEXT PRIMARY KEY, | ||
host TEXT, | ||
status TEXT, | ||
time_created DATETIME DEFAULT CURRENT_TIMESTAMP, | ||
commands JSON, | ||
output JSON | ||
) | ||
""" | ||
) | ||
conn.commit() |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.