mirror of
https://github.com/Steffo99/greed.git
synced 2024-11-25 07:14:18 +00:00
Add the basic sqlalchemy code
This commit is contained in:
parent
56d06ea1d2
commit
14aa9697f7
1 changed files with 27 additions and 0 deletions
27
database.py
Normal file
27
database.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
from sqlalchemy import Table, Column, BigInteger, Numeric, String, Text, MetaData, ForeignKey
|
||||
import decimal
|
||||
|
||||
# Create a metadata object containing info about the tables in the database
|
||||
metadata = MetaData()
|
||||
|
||||
# Metadata for the users table
|
||||
# TODO: maybe add a 'credit' column
|
||||
users = Table("users", metadata,
|
||||
Column("telegram_user_id", BigInteger, primary_key=True),
|
||||
Column("first_name", String, nullable=False),
|
||||
Column("last_name", String),
|
||||
Column("username", String))
|
||||
|
||||
# Metadata for the admins table
|
||||
# TODO: add columns for all the possible permissions
|
||||
admins = Table("admins", metadata,
|
||||
Column("telegram_user_id", ForeignKey("users.telegram_user_id"), primary_key=True))
|
||||
|
||||
# Metadata for the products table
|
||||
products = Table("products", metadata,
|
||||
Column("product_name", String, primary_key=True),
|
||||
Column("description", Text),
|
||||
Column("price", Numeric(...)))
|
||||
|
||||
#TODO: many things are still missing...
|
||||
raise NotImplementedError()
|
Loading…
Reference in a new issue