-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_db.py
More file actions
19 lines (17 loc) · 1.04 KB
/
create_db.py
File metadata and controls
19 lines (17 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import sqlite3
def create_db():
con=sqlite3.connect(database=r'ims.db')
cur=con.cursor()
cur.execute("CREATE TABLE IF NOT EXISTS employee(eid INTEGER PRIMARY KEY AUTOINCREMENT,name text,email text,gender text,contact text,dob text,doj text,pass text,utype text,address text,salary text)")
con.commit()
cur.execute("CREATE TABLE IF NOT EXISTS supplier(invoice INTEGER PRIMARY KEY AUTOINCREMENT,name text,contact text,desc text)")
con.commit()
cur.execute("CREATE TABLE IF NOT EXISTS category(cid INTEGER PRIMARY KEY AUTOINCREMENT,name text)")
con.commit()
cur.execute("CREATE TABLE IF NOT EXISTS product(pid INTEGER PRIMARY KEY AUTOINCREMENT,Category text, Supplier text,name text,price text,qty text,status text)")
con.commit()
cur.execute("CREATE TABLE IF NOT EXISTS user(Username TEXT PRIMARY KEY, Password_hash text not null)")
con.commit()
cur.execute("INSERT INTO user(Username, Password_hash) VALUES ('admin', '$2b$12$6dMOWbkuL8x2rcD3uu4x9erRsQ0mK6kvC0ibkx42v9HkskgIa04gO')")
con.commit()
create_db()