mirror of
https://github.com/wlinator/luminara.git
synced 2024-10-02 20:23:12 +00:00
Clear DB redundancy
This commit is contained in:
parent
883e04a55c
commit
aff58a781f
2 changed files with 2 additions and 125 deletions
121
db/tables.py
121
db/tables.py
|
@ -1,121 +0,0 @@
|
|||
import logging
|
||||
|
||||
from db import database
|
||||
|
||||
racu_logs = logging.getLogger('Racu.Core')
|
||||
|
||||
xp_table = """
|
||||
CREATE TABLE IF NOT EXISTS xp (
|
||||
user_id INTEGER PRIMARY KEY NOT NULL,
|
||||
user_xp INTEGER NOT NULL,
|
||||
user_level INTEGER NOT NULL,
|
||||
cooldown REAL
|
||||
)
|
||||
"""
|
||||
|
||||
currency_table = """
|
||||
CREATE TABLE IF NOT EXISTS currency (
|
||||
user_id INTEGER PRIMARY KEY NOT NULL,
|
||||
cash_balance INTEGER NOT NULL,
|
||||
special_balance INTEGER
|
||||
)
|
||||
"""
|
||||
|
||||
item_table = """
|
||||
CREATE TABLE IF NOT EXISTS item (
|
||||
id INTEGER PRIMARY KEY,
|
||||
name TEXT,
|
||||
display_name TEXT,
|
||||
description TEXT,
|
||||
image_url TEXT,
|
||||
emote_id INTEGER,
|
||||
quote TEXT,
|
||||
type TEXT
|
||||
)
|
||||
"""
|
||||
|
||||
inventory_table = """
|
||||
CREATE TABLE IF NOT EXISTS inventory (
|
||||
user_id INTEGER,
|
||||
item_id INTEGER,
|
||||
quantity INTEGER,
|
||||
|
||||
PRIMARY KEY (user_id, item_id),
|
||||
FOREIGN KEY (item_id) REFERENCES item (id)
|
||||
)
|
||||
"""
|
||||
|
||||
shop_item_table = """
|
||||
CREATE TABLE IF NOT EXISTS ShopItem (
|
||||
item_id INTEGER PRIMARY KEY,
|
||||
price INTEGER,
|
||||
price_special INTEGER,
|
||||
worth INTEGER,
|
||||
description TEXT
|
||||
)
|
||||
"""
|
||||
|
||||
dailies_table = """
|
||||
CREATE TABLE IF NOT EXISTS dailies (
|
||||
id INTEGER PRIMARY KEY,
|
||||
user_id INTEGER,
|
||||
amount INTEGER,
|
||||
claimed_at REAL,
|
||||
streak INTEGER
|
||||
)
|
||||
"""
|
||||
|
||||
stats_bj = """
|
||||
CREATE TABLE IF NOT EXISTS stats_bj (
|
||||
id INTEGER PRIMARY KEY,
|
||||
user_id INTEGER,
|
||||
is_won INTEGER,
|
||||
bet INTEGER,
|
||||
payout INTEGER,
|
||||
hand_player TEXT,
|
||||
hand_dealer TEXT
|
||||
)
|
||||
"""
|
||||
|
||||
stats_slots = """
|
||||
CREATE TABLE IF NOT EXISTS stats_slots (
|
||||
id INTEGER PRIMARY KEY,
|
||||
user_id INTEGER,
|
||||
is_won INTEGER,
|
||||
bet INTEGER,
|
||||
payout INTEGER,
|
||||
spin_type TEXT,
|
||||
icons TEXT
|
||||
)
|
||||
"""
|
||||
|
||||
stats_duel = """
|
||||
CREATE TABLE IF NOT EXISTS stats_duel (
|
||||
id INTEGER PRIMARY KEY,
|
||||
user_id INTEGER,
|
||||
is_won INTEGER,
|
||||
bet INTEGER
|
||||
)
|
||||
"""
|
||||
|
||||
birthdays_table = """
|
||||
CREATE TABLE IF NOT EXISTS birthdays (
|
||||
user_id INTEGER PRIMARY KEY,
|
||||
birthday REAL
|
||||
)
|
||||
"""
|
||||
|
||||
|
||||
def sync_database():
|
||||
database.execute_query(xp_table)
|
||||
database.execute_query(currency_table)
|
||||
database.execute_query(item_table)
|
||||
database.execute_query(inventory_table)
|
||||
database.execute_query(shop_item_table)
|
||||
database.execute_query(dailies_table)
|
||||
database.execute_query(stats_bj)
|
||||
database.execute_query(stats_slots)
|
||||
database.execute_query(stats_duel)
|
||||
database.execute_query(birthdays_table)
|
||||
|
||||
racu_logs.info("Database was synced.")
|
6
main.py
6
main.py
|
@ -10,7 +10,6 @@ import pytz
|
|||
from discord.ext import commands
|
||||
from dotenv import load_dotenv
|
||||
|
||||
import db.tables
|
||||
import sb_tools.resources
|
||||
from config import json_loader
|
||||
from data.Item import Item
|
||||
|
@ -268,9 +267,8 @@ if __name__ == '__main__':
|
|||
|
||||
load_dotenv('.env')
|
||||
|
||||
# load db
|
||||
# db.tables.sync_database()
|
||||
# Item.insert_items()
|
||||
# replace all items, if there are any changes they will be overwritten
|
||||
Item.insert_items()
|
||||
|
||||
load_cogs()
|
||||
|
||||
|
|
Loading…
Reference in a new issue