import sqlite3 import os # Define the database file name db_file = "items.db" # Check if the database file exists, and delete it if it does if os.path.exists(db_file): os.remove(db_file) # Connect to the SQLite database (create a new one since the old one was deleted) conn = sqlite3.connect(db_file) # Create a cursor object to interact with the database cursor = conn.cursor() # Execute the SQL command to create the table cursor.execute( """CREATE TABLE IF NOT EXISTS ammo ( id TEXT PRIMARY KEY, type TEXT, name TEXT, rarity INTEGER, weight REAL, width INTEGER, height INTEGER, value INTEGER, stack INTEGER )""" ) # Execute the SQL command to create the table cursor.execute( """CREATE TABLE IF NOT EXISTS reloading ( id TEXT PRIMARY KEY, type TEXT, name TEXT, rarity INTEGER, weight REAL, width INTEGER, height INTEGER, value INTEGER, stack INTEGER )""" ) # Execute the SQL command to create the table cursor.execute( """CREATE TABLE IF NOT EXISTS consumable ( id TEXT PRIMARY KEY, type TEXT, name TEXT, rarity INTEGER, weight REAL, width INTEGER, height INTEGER, value INTEGER, stack INTEGER )""" ) # Execute the SQL command to create the table cursor.execute( """CREATE TABLE IF NOT EXISTS craft ( id TEXT PRIMARY KEY, type TEXT, name TEXT, rarity INTEGER, weight REAL, width INTEGER, height INTEGER, value INTEGER, stack INTEGER )""" ) # Execute the SQL command to create the table cursor.execute( """CREATE TABLE IF NOT EXISTS gear ( id TEXT PRIMARY KEY, type TEXT, name TEXT, rarity INTEGER, weight REAL, width INTEGER, height INTEGER, value INTEGER, stack INTEGER )""" ) # Execute the SQL command to create the table cursor.execute( """CREATE TABLE IF NOT EXISTS parts ( id TEXT PRIMARY KEY, type TEXT, name TEXT, rarity INTEGER, weight REAL, width INTEGER, height INTEGER, value INTEGER, stack INTEGER )""" ) # Execute the SQL command to create the table cursor.execute( """CREATE TABLE IF NOT EXISTS guns ( id TEXT PRIMARY KEY, type TEXT, name TEXT, rarity INTEGER, weight REAL, width INTEGER, height INTEGER, value INTEGER, stack INTEGER )""" ) # Execute the SQL command to create the table cursor.execute( """CREATE TABLE IF NOT EXISTS medicine ( id TEXT PRIMARY KEY, type TEXT, name TEXT, rarity INTEGER, weight REAL, width INTEGER, height INTEGER, value INTEGER, stack INTEGER )""" ) # Execute the SQL command to create the table cursor.execute( """CREATE TABLE IF NOT EXISTS miscelaneous ( id TEXT PRIMARY KEY, type TEXT, name TEXT, rarity INTEGER, weight REAL, width INTEGER, height INTEGER, value INTEGER, stack INTEGER )""" ) # Commit the changes and close the database connection conn.commit() conn.close()