-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateDatabase.py
More file actions
21 lines (19 loc) · 945 Bytes
/
createDatabase.py
File metadata and controls
21 lines (19 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import sqlite3
import os
def createDatabase():
contains = False
b = os.path.dirname(os.path.dirname(__file__))
files = os.listdir(b)
if 'Tasker.db' in files:
contains = True
if contains == False:
try:
conn = sqlite3.connect('Tasker.db')
crsr = conn.cursor()
crsr.execute("CREATE TABLE 'Stage' ('Project_id' TEXT,'name' TEXT,'desc' TEXT,'tasks' TEXT,'reward' INTEGER)")
crsr.execute("CREATE TABLE 'Task' ('Project_id' TEXT,'Name' TEXT,'Description' TEXT,'Assignee' TEXT,'Deadline' TEXT)")
crsr.execute("CREATE TABLE 'cred' ('username' TEXT,'password' TEXT,'full_name' TEXT)")
crsr.execute("CREATE TABLE 'project' ('ProjectID' TEXT,'Name' TEXT,'Description' TEXT,'Deadline' DATE,'owner' TEXT,'team_member' TEXT)")
print("DATABASE CREATED SUCCESSFULLY")
except:
print("FAILED IN CREATING DATABASE !!!")