Newer
Older
def table_check(): #This function is used on start to make a new Database if not already exists.
create_table_data = """
CREATE TABLE WEB_URL(
LONG_URL TEXT NOT NULL,
SHORT_URL TEXT NOT NULL,
USERNAME TEXT
);
"""
create_table_analytics = """
CREATE TABLE ANALYTICS(
SHORT_URL TEXT NOT NULL,
CALLS INT DEFAULT 1
)
"""
cursor = conn.cursor()
try: #Try making the database structure, if fails Database was already created.
cursor.execute(create_table_data)
pass
try: #Try making the database structure, if fails Database was already created.
cursor.execute(create_table_analytics)
pass
if (__name__ == "__main__"):
print("This file is not made fore direct call, please run the main.py")
exit()