Init: get pit schema
This commit is contained in:
50
pits.py
Normal file
50
pits.py
Normal file
@@ -0,0 +1,50 @@
|
||||
import sqlite3
|
||||
import os
|
||||
|
||||
db_filename = 'pits.sql'
|
||||
|
||||
db_is_new = not os.path.exists(db_filename)
|
||||
|
||||
conn = sqlite3.connect(db_filename)
|
||||
|
||||
if db_is_new:
|
||||
conn.execute('''CREATE TABLE project (
|
||||
id int,
|
||||
username text,
|
||||
name text,
|
||||
status text,
|
||||
created_at timestring,
|
||||
updatet_at timestring
|
||||
)''')
|
||||
|
||||
conn.execute('''CREATE TABLE task (
|
||||
id int,
|
||||
project_id int,
|
||||
username text,
|
||||
name text,
|
||||
status text,
|
||||
priority text,
|
||||
date timestring,
|
||||
time timestring,
|
||||
created_at timestring,
|
||||
updated_at timestring
|
||||
)''')
|
||||
|
||||
conn.execute('''CREATE TABLE note (
|
||||
id int,
|
||||
project_id int,
|
||||
task_id int,
|
||||
username text,
|
||||
message text,
|
||||
created_at timestring,
|
||||
updated_at timestring
|
||||
)''')
|
||||
|
||||
conn.execute('''CREATE TABLE action (
|
||||
project_id int,
|
||||
task_id int,
|
||||
note_id int,
|
||||
username text,
|
||||
message text,
|
||||
created_at timestring
|
||||
)''')
|
||||
Reference in New Issue
Block a user