Remove: Old database files.
This commit is contained in:
@@ -1,13 +0,0 @@
|
|||||||
"""Small script to create the database if it doesn't already exist."""
|
|
||||||
|
|
||||||
import sqlite3
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
if not Path("database/dakiny.db").exists():
|
|
||||||
with sqlite3.connect("database/dakiny.db") as con:
|
|
||||||
cur = con.cursor()
|
|
||||||
|
|
||||||
with Path("dakiny_bot/database/database.sql").open() as file:
|
|
||||||
database_script = file.read()
|
|
||||||
cur.executescript(database_script)
|
|
||||||
con.commit()
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
"""Simple file to set up the sqlalchemy connection to database."""
|
|
||||||
|
|
||||||
from sqlalchemy import create_engine
|
|
||||||
from sqlalchemy.ext.automap import automap_base
|
|
||||||
|
|
||||||
# connect with sql alchemy and autoload schema
|
|
||||||
URL = "sqlite+pysqlite:///database/dakiny.db"
|
|
||||||
engine = create_engine(URL)
|
|
||||||
Base = automap_base()
|
|
||||||
Base.prepare(autoload_with=engine)
|
|
||||||
|
|
||||||
# define the classes
|
|
||||||
Points = Base.classes.Points
|
|
||||||
PointsLimit = Base.classes.PointsLimit
|
|
||||||
CouncilMembers = Base.classes.CouncilMembers
|
|
||||||
ElectionInformation = Base.classes.ElectionInformation
|
|
||||||
Messages = Base.classes.Messages
|
|
||||||
Presences = Base.classes.Presences
|
|
||||||
UserBirthday = Base.classes.UserBirthday
|
|
||||||
Votes = Base.classes.Votes
|
|
||||||
Reference in New Issue
Block a user