1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2025-02-16 18:33:58 +00:00

Build Royalpack database

This commit is contained in:
Steffo 2021-04-18 00:39:43 +02:00
parent afd202677c
commit eb7a5b05f6
Signed by: steffo
GPG key ID: 6965406171929D01
12 changed files with 868 additions and 41 deletions

90
alembic.ini Normal file
View file

@ -0,0 +1,90 @@
# A generic, single database configuration.
[alembic]
# path to migration scripts
script_location = ./royalpack/database/alembic
# template used to generate migration files
# file_template = %%(rev)s_%%(slug)s
# sys.path path, will be prepended to sys.path if present.
# defaults to the current working directory.
prepend_sys_path = .
# timezone to use when rendering the date
# within the migration file as well as the filename.
# string value is passed to dateutil.tz.gettz()
# leave blank for localtime
# timezone =
# max length of characters to apply to the
# "slug" field
# truncate_slug_length = 40
# set to 'true' to run the environment during
# the 'revision' command, regardless of autogenerate
# revision_environment = false
# set to 'true' to allow .pyc and .pyo files without
# a source .py file to be detected as revisions in the
# versions/ directory
# sourceless = false
# version location specification; this defaults
# to royalpack/database/alembic/versions. When using multiple version
# directories, initial revisions must be specified with --version-path
# version_locations = %(here)s/bar %(here)s/bat royalpack/database/alembic/versions
# the output encoding used when revision files
# are written from script.py.mako
# output_encoding = utf-8
# Ignored; alembic is configured to use the Mandarin config file
# sqlalchemy.url = driver://user:pass@localhost/dbname
[post_write_hooks]
# post_write_hooks defines scripts or Python functions that are run
# on newly generated revision scripts. See the documentation for further
# detail and examples
# format using "black" - use the console_scripts runner, against the "black" entrypoint
# hooks=black
# black.type=console_scripts
# black.entrypoint=black
# black.options=-l 79
# Logging configuration
[loggers]
keys = root,sqlalchemy,alembic
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARN
handlers = console
qualname =
[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine
[logger_alembic]
level = INFO
handlers =
qualname = alembic
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S

304
poetry.lock generated
View file

@ -17,6 +17,31 @@ yarl = ">=1.0,<2.0"
[package.extras]
speedups = ["aiodns", "brotlipy", "cchardet"]
[[package]]
name = "alembic"
version = "1.5.8"
description = "A database migration tool for SQLAlchemy."
category = "main"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7"
[package.dependencies]
Mako = "*"
python-dateutil = "*"
python-editor = ">=0.3"
SQLAlchemy = ">=1.3.0"
[[package]]
name = "arrow"
version = "1.0.3"
description = "Better dates & times for Python"
category = "main"
optional = false
python-versions = ">=3.6"
[package.dependencies]
python-dateutil = ">=2.7.0"
[[package]]
name = "async-property"
version = "0.2.1"
@ -47,6 +72,14 @@ docs = ["furo", "sphinx", "zope.interface"]
tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface"]
tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six"]
[[package]]
name = "cachetools"
version = "4.2.1"
description = "Extensible memoizing collections and decorators"
category = "main"
optional = false
python-versions = "~=3.5"
[[package]]
name = "chardet"
version = "4.0.0"
@ -85,6 +118,17 @@ humanfriendly = ">=9.1"
[package.extras]
cron = ["capturer (>=2.4)"]
[[package]]
name = "colour"
version = "0.1.5"
description = "converts and manipulates various color representation (HSL, RVB, web, X11, ...)"
category = "main"
optional = false
python-versions = "*"
[package.extras]
test = ["nose"]
[[package]]
name = "greenlet"
version = "1.0.0"
@ -115,6 +159,29 @@ category = "main"
optional = false
python-versions = ">=3.4"
[[package]]
name = "mako"
version = "1.1.4"
description = "A super-fast templating language that borrows the best ideas from the existing templating languages."
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
[package.dependencies]
MarkupSafe = ">=0.9.2"
[package.extras]
babel = ["babel"]
lingua = ["lingua"]
[[package]]
name = "markupsafe"
version = "1.1.1"
description = "Safely add untrusted strings to HTML/XML markup."
category = "main"
optional = false
python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*"
[[package]]
name = "multidict"
version = "5.1.0"
@ -158,6 +225,14 @@ category = "main"
optional = false
python-versions = "*"
[[package]]
name = "pycryptodomex"
version = "3.10.1"
description = "Cryptographic library for Python"
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
[[package]]
name = "pydantic"
version = "1.8.1"
@ -181,6 +256,37 @@ category = "main"
optional = false
python-versions = "*"
[[package]]
name = "python-dateutil"
version = "2.8.1"
description = "Extensions to the standard Python datetime module"
category = "main"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7"
[package.dependencies]
six = ">=1.5"
[[package]]
name = "python-editor"
version = "1.0.4"
description = "Programmatically open an editor, capture the result."
category = "main"
optional = false
python-versions = "*"
[[package]]
name = "requests"
version = "2.15.1"
description = "Python HTTP for Humans."
category = "main"
optional = false
python-versions = "*"
[package.extras]
security = ["cryptography (>=1.3.4)", "idna (>=2.0.0)", "pyOpenSSL (>=0.14)"]
socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"]
[[package]]
name = "royalnet"
version = "6.4.4"
@ -233,6 +339,14 @@ python-versions = ">=3.5, <4"
[package.dependencies]
pyasn1 = ">=0.1.3"
[[package]]
name = "six"
version = "1.15.0"
description = "Python 2 and 3 compatibility utilities"
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
[[package]]
name = "sqlalchemy"
version = "1.4.8"
@ -264,6 +378,51 @@ postgresql_psycopg2cffi = ["psycopg2cffi"]
pymysql = ["pymysql (<1)", "pymysql"]
sqlcipher = ["sqlcipher3-binary"]
[[package]]
name = "sqlalchemy-utils"
version = "0.37.0"
description = "Various utility functions for SQLAlchemy."
category = "main"
optional = false
python-versions = "*"
[package.dependencies]
six = "*"
SQLAlchemy = ">=1.0"
[package.extras]
anyjson = ["anyjson (>=0.3.3)"]
arrow = ["arrow (>=0.3.4)"]
babel = ["Babel (>=1.3)"]
color = ["colour (>=0.0.4)"]
encrypted = ["cryptography (>=0.6)"]
intervals = ["intervals (>=0.7.1)"]
password = ["passlib (>=1.6,<2.0)"]
pendulum = ["pendulum (>=2.0.5)"]
phone = ["phonenumbers (>=5.9.2)"]
test = ["pytest (>=2.7.1)", "Pygments (>=1.2)", "Jinja2 (>=2.3)", "docutils (>=0.10)", "flexmock (>=0.9.7)", "mock (==2.0.0)", "psycopg2 (>=2.5.1)", "psycopg2cffi (>=2.8.1)", "pg8000 (>=1.12.4)", "pytz (>=2014.2)", "python-dateutil (>=2.6)", "pymysql", "flake8 (>=2.4.0)", "isort (>=4.2.2)", "pyodbc"]
test_all = ["Babel (>=1.3)", "Jinja2 (>=2.3)", "Pygments (>=1.2)", "anyjson (>=0.3.3)", "arrow (>=0.3.4)", "colour (>=0.0.4)", "cryptography (>=0.6)", "docutils (>=0.10)", "flake8 (>=2.4.0)", "flexmock (>=0.9.7)", "furl (>=0.4.1)", "intervals (>=0.7.1)", "isort (>=4.2.2)", "mock (==2.0.0)", "passlib (>=1.6,<2.0)", "pendulum (>=2.0.5)", "pg8000 (>=1.12.4)", "phonenumbers (>=5.9.2)", "psycopg2 (>=2.5.1)", "psycopg2cffi (>=2.8.1)", "pymysql", "pyodbc", "pytest (>=2.7.1)", "python-dateutil", "python-dateutil (>=2.6)", "pytz (>=2014.2)"]
timezone = ["python-dateutil"]
url = ["furl (>=0.4.1)"]
[[package]]
name = "steam"
version = "1.2.0"
description = "Module for interacting with various Steam features"
category = "main"
optional = false
python-versions = "*"
[package.dependencies]
cachetools = ">=3.0.0"
pycryptodomex = ">=3.7.0"
requests = ">=2.9.1"
six = ">=1.10"
vdf = ">=3.3"
[package.extras]
client = ["gevent (>=1.3.0)", "protobuf (>=3.0.0)", "gevent-eventemitter (>=2.1)"]
[[package]]
name = "telethon"
version = "1.21.1"
@ -295,6 +454,14 @@ category = "main"
optional = false
python-versions = "*"
[[package]]
name = "vdf"
version = "3.3"
description = "Library for working with Valve's VDF text format"
category = "main"
optional = false
python-versions = "*"
[[package]]
name = "yarl"
version = "1.6.3"
@ -310,7 +477,7 @@ multidict = ">=4.0"
[metadata]
lock-version = "1.1"
python-versions = "^3.8"
content-hash = "ee3e2688b7efdc4f47dcd19bb3eab30036dbee2cc34e2123324fc3b02febac0c"
content-hash = "cc2148a9c174c4a3878f17faa4812d2cc738efedcbea07d6a87328f81849efc9"
[metadata.files]
aiohttp = [
@ -352,6 +519,14 @@ aiohttp = [
{file = "aiohttp-3.7.4.post0-cp39-cp39-win_amd64.whl", hash = "sha256:02f46fc0e3c5ac58b80d4d56eb0a7c7d97fcef69ace9326289fb9f1955e65cfe"},
{file = "aiohttp-3.7.4.post0.tar.gz", hash = "sha256:493d3299ebe5f5a7c66b9819eacdcfbbaaf1a8e84911ddffcdc48888497afecf"},
]
alembic = [
{file = "alembic-1.5.8-py2.py3-none-any.whl", hash = "sha256:8a259f0a4c8b350b03579d77ce9e810b19c65bf0af05f84efb69af13ad50801e"},
{file = "alembic-1.5.8.tar.gz", hash = "sha256:e27fd67732c97a1c370c33169ef4578cf96436fa0e7dcfaeeef4a917d0737d56"},
]
arrow = [
{file = "arrow-1.0.3-py3-none-any.whl", hash = "sha256:3515630f11a15c61dcb4cdd245883270dd334c83f3e639824e65a4b79cc48543"},
{file = "arrow-1.0.3.tar.gz", hash = "sha256:399c9c8ae732270e1aa58ead835a79a40d7be8aa109c579898eb41029b5a231d"},
]
async-property = [
{file = "async_property-0.2.1-py2.py3-none-any.whl", hash = "sha256:f1f105009a6216ed9a13031aa13632754ed8a5c2e329fb8f9f2082d83529eacd"},
{file = "async_property-0.2.1.tar.gz", hash = "sha256:53826fd45a67d7d6cca3d7abbc0e8ba951f7c7618c830021fbd3675979b0b67d"},
@ -364,6 +539,10 @@ attrs = [
{file = "attrs-20.3.0-py2.py3-none-any.whl", hash = "sha256:31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6"},
{file = "attrs-20.3.0.tar.gz", hash = "sha256:832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700"},
]
cachetools = [
{file = "cachetools-4.2.1-py3-none-any.whl", hash = "sha256:1d9d5f567be80f7c07d765e21b814326d78c61eb0c3a637dffc0e5d1796cb2e2"},
{file = "cachetools-4.2.1.tar.gz", hash = "sha256:f469e29e7aa4cff64d8de4aad95ce76de8ea1125a16c68e0d93f65c3c3dc92e9"},
]
chardet = [
{file = "chardet-4.0.0-py2.py3-none-any.whl", hash = "sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5"},
{file = "chardet-4.0.0.tar.gz", hash = "sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa"},
@ -380,6 +559,10 @@ coloredlogs = [
{file = "coloredlogs-15.0-py2.py3-none-any.whl", hash = "sha256:b7f630a8297a66984b6bae0f6a1b0e0afb9f2f6838ea3bfa58f50d3d13e133d6"},
{file = "coloredlogs-15.0.tar.gz", hash = "sha256:5e78691e2673a8e294499e1832bb13efcfb44a86b92e18109fa18951093218ab"},
]
colour = [
{file = "colour-0.1.5-py2.py3-none-any.whl", hash = "sha256:33f6db9d564fadc16e59921a56999b79571160ce09916303d35346dddc17978c"},
{file = "colour-0.1.5.tar.gz", hash = "sha256:af20120fefd2afede8b001fbef2ea9da70ad7d49fafdb6489025dae8745c3aee"},
]
greenlet = [
{file = "greenlet-1.0.0-cp27-cp27m-macosx_10_14_x86_64.whl", hash = "sha256:1d1d4473ecb1c1d31ce8fd8d91e4da1b1f64d425c1dc965edc4ed2a63cfa67b2"},
{file = "greenlet-1.0.0-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:cfd06e0f0cc8db2a854137bd79154b61ecd940dce96fad0cba23fe31de0b793c"},
@ -433,6 +616,64 @@ idna = [
{file = "idna-3.1-py3-none-any.whl", hash = "sha256:5205d03e7bcbb919cc9c19885f9920d622ca52448306f2377daede5cf3faac16"},
{file = "idna-3.1.tar.gz", hash = "sha256:c5b02147e01ea9920e6b0a3f1f7bb833612d507592c837a6c49552768f4054e1"},
]
mako = [
{file = "Mako-1.1.4-py2.py3-none-any.whl", hash = "sha256:aea166356da44b9b830c8023cd9b557fa856bd8b4035d6de771ca027dfc5cc6e"},
{file = "Mako-1.1.4.tar.gz", hash = "sha256:17831f0b7087c313c0ffae2bcbbd3c1d5ba9eeac9c38f2eb7b50e8c99fe9d5ab"},
]
markupsafe = [
{file = "MarkupSafe-1.1.1-cp27-cp27m-macosx_10_6_intel.whl", hash = "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161"},
{file = "MarkupSafe-1.1.1-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7"},
{file = "MarkupSafe-1.1.1-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183"},
{file = "MarkupSafe-1.1.1-cp27-cp27m-win32.whl", hash = "sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b"},
{file = "MarkupSafe-1.1.1-cp27-cp27m-win_amd64.whl", hash = "sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e"},
{file = "MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f"},
{file = "MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1"},
{file = "MarkupSafe-1.1.1-cp34-cp34m-macosx_10_6_intel.whl", hash = "sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5"},
{file = "MarkupSafe-1.1.1-cp34-cp34m-manylinux1_i686.whl", hash = "sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1"},
{file = "MarkupSafe-1.1.1-cp34-cp34m-manylinux1_x86_64.whl", hash = "sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735"},
{file = "MarkupSafe-1.1.1-cp34-cp34m-win32.whl", hash = "sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21"},
{file = "MarkupSafe-1.1.1-cp34-cp34m-win_amd64.whl", hash = "sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235"},
{file = "MarkupSafe-1.1.1-cp35-cp35m-macosx_10_6_intel.whl", hash = "sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b"},
{file = "MarkupSafe-1.1.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f"},
{file = "MarkupSafe-1.1.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905"},
{file = "MarkupSafe-1.1.1-cp35-cp35m-win32.whl", hash = "sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1"},
{file = "MarkupSafe-1.1.1-cp35-cp35m-win_amd64.whl", hash = "sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d"},
{file = "MarkupSafe-1.1.1-cp36-cp36m-macosx_10_6_intel.whl", hash = "sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff"},
{file = "MarkupSafe-1.1.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:d53bc011414228441014aa71dbec320c66468c1030aae3a6e29778a3382d96e5"},
{file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473"},
{file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e"},
{file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:3b8a6499709d29c2e2399569d96719a1b21dcd94410a586a18526b143ec8470f"},
{file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:84dee80c15f1b560d55bcfe6d47b27d070b4681c699c572af2e3c7cc90a3b8e0"},
{file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:b1dba4527182c95a0db8b6060cc98ac49b9e2f5e64320e2b56e47cb2831978c7"},
{file = "MarkupSafe-1.1.1-cp36-cp36m-win32.whl", hash = "sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66"},
{file = "MarkupSafe-1.1.1-cp36-cp36m-win_amd64.whl", hash = "sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5"},
{file = "MarkupSafe-1.1.1-cp37-cp37m-macosx_10_6_intel.whl", hash = "sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d"},
{file = "MarkupSafe-1.1.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:bf5aa3cbcfdf57fa2ee9cd1822c862ef23037f5c832ad09cfea57fa846dec193"},
{file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e"},
{file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6"},
{file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:6fffc775d90dcc9aed1b89219549b329a9250d918fd0b8fa8d93d154918422e1"},
{file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:a6a744282b7718a2a62d2ed9d993cad6f5f585605ad352c11de459f4108df0a1"},
{file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:195d7d2c4fbb0ee8139a6cf67194f3973a6b3042d742ebe0a9ed36d8b6f0c07f"},
{file = "MarkupSafe-1.1.1-cp37-cp37m-win32.whl", hash = "sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2"},
{file = "MarkupSafe-1.1.1-cp37-cp37m-win_amd64.whl", hash = "sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c"},
{file = "MarkupSafe-1.1.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6788b695d50a51edb699cb55e35487e430fa21f1ed838122d722e0ff0ac5ba15"},
{file = "MarkupSafe-1.1.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:cdb132fc825c38e1aeec2c8aa9338310d29d337bebbd7baa06889d09a60a1fa2"},
{file = "MarkupSafe-1.1.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:13d3144e1e340870b25e7b10b98d779608c02016d5184cfb9927a9f10c689f42"},
{file = "MarkupSafe-1.1.1-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:acf08ac40292838b3cbbb06cfe9b2cb9ec78fce8baca31ddb87aaac2e2dc3bc2"},
{file = "MarkupSafe-1.1.1-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:d9be0ba6c527163cbed5e0857c451fcd092ce83947944d6c14bc95441203f032"},
{file = "MarkupSafe-1.1.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:caabedc8323f1e93231b52fc32bdcde6db817623d33e100708d9a68e1f53b26b"},
{file = "MarkupSafe-1.1.1-cp38-cp38-win32.whl", hash = "sha256:596510de112c685489095da617b5bcbbac7dd6384aeebeda4df6025d0256a81b"},
{file = "MarkupSafe-1.1.1-cp38-cp38-win_amd64.whl", hash = "sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be"},
{file = "MarkupSafe-1.1.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:d73a845f227b0bfe8a7455ee623525ee656a9e2e749e4742706d80a6065d5e2c"},
{file = "MarkupSafe-1.1.1-cp39-cp39-manylinux1_i686.whl", hash = "sha256:98bae9582248d6cf62321dcb52aaf5d9adf0bad3b40582925ef7c7f0ed85fceb"},
{file = "MarkupSafe-1.1.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:2beec1e0de6924ea551859edb9e7679da6e4870d32cb766240ce17e0a0ba2014"},
{file = "MarkupSafe-1.1.1-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:7fed13866cf14bba33e7176717346713881f56d9d2bcebab207f7a036f41b850"},
{file = "MarkupSafe-1.1.1-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:6f1e273a344928347c1290119b493a1f0303c52f5a5eae5f16d74f48c15d4a85"},
{file = "MarkupSafe-1.1.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:feb7b34d6325451ef96bc0e36e1a6c0c1c64bc1fbec4b854f4529e51887b1621"},
{file = "MarkupSafe-1.1.1-cp39-cp39-win32.whl", hash = "sha256:22c178a091fc6630d0d045bdb5992d2dfe14e3259760e713c490da5323866c39"},
{file = "MarkupSafe-1.1.1-cp39-cp39-win_amd64.whl", hash = "sha256:b7d644ddb4dbd407d31ffb699f1d140bc35478da613b441c582aeb7c43838dd8"},
{file = "MarkupSafe-1.1.1.tar.gz", hash = "sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b"},
]
multidict = [
{file = "multidict-5.1.0-cp36-cp36m-macosx_10_14_x86_64.whl", hash = "sha256:b7993704f1a4b204e71debe6095150d43b2ee6150fa4f44d6d966ec356a8d61f"},
{file = "multidict-5.1.0-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:9dd6e9b1a913d096ac95d0399bd737e00f2af1e1594a787e00f7975778c8b2bf"},
@ -537,6 +778,38 @@ pyasn1 = [
{file = "pyasn1-0.4.8-py3.7.egg", hash = "sha256:99fcc3c8d804d1bc6d9a099921e39d827026409a58f2a720dcdb89374ea0c776"},
{file = "pyasn1-0.4.8.tar.gz", hash = "sha256:aef77c9fb94a3ac588e87841208bdec464471d9871bd5050a287cc9a475cd0ba"},
]
pycryptodomex = [
{file = "pycryptodomex-3.10.1-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:4344ab16faf6c2d9df2b6772995623698fb2d5f114dace4ab2ff335550cf71d5"},
{file = "pycryptodomex-3.10.1-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:f933ecf4cb736c7af60a6a533db2bf569717f2318b265f92907acff1db43bc34"},
{file = "pycryptodomex-3.10.1-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:0bd35af6a18b724c689e56f2dbbdd8e409288be71952d271ba3d9614b31d188c"},
{file = "pycryptodomex-3.10.1-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:ec9901d19cadb80d9235ee41cc58983f18660314a0eb3fc7b11b0522ac3b6c4a"},
{file = "pycryptodomex-3.10.1-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:c2b680987f418858e89dbb4f09c8c919ece62811780a27051ace72b2f69fb1be"},
{file = "pycryptodomex-3.10.1-cp27-cp27m-manylinux2014_aarch64.whl", hash = "sha256:a6584ae58001d17bb4dc0faa8a426919c2c028ef4d90ceb4191802ca6edb8204"},
{file = "pycryptodomex-3.10.1-cp27-cp27m-win32.whl", hash = "sha256:4195604f75cdc1db9bccdb9e44d783add3c817319c30aaff011670c9ed167690"},
{file = "pycryptodomex-3.10.1-cp27-cp27m-win_amd64.whl", hash = "sha256:9f713ffb4e27b5575bd917c70bbc3f7b348241a351015dbbc514c01b7061ff7e"},
{file = "pycryptodomex-3.10.1-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:418f51c61eab52d9920f4ef468d22c89dab1be5ac796f71cf3802f6a6e667df0"},
{file = "pycryptodomex-3.10.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:8a98e02cbf8f624add45deff444539bf26345b479fc04fa0937b23cd84078d91"},
{file = "pycryptodomex-3.10.1-cp27-cp27mu-manylinux2010_i686.whl", hash = "sha256:dbd2c361db939a4252589baa94da4404d45e3fc70da1a31e541644cdf354336e"},
{file = "pycryptodomex-3.10.1-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:564063e3782474c92cbb333effd06e6eb718471783c6e67f28c63f0fc3ac7b23"},
{file = "pycryptodomex-3.10.1-cp27-cp27mu-manylinux2014_aarch64.whl", hash = "sha256:e4a1245e7b846e88ba63e7543483bda61b9acbaee61eadbead5a1ce479d94740"},
{file = "pycryptodomex-3.10.1-cp35-abi3-macosx_10_9_x86_64.whl", hash = "sha256:3b8eb85b3cc7f083d87978c264d10ff9de3b4bfc46f1c6fdc2792e7d7ebc87bb"},
{file = "pycryptodomex-3.10.1-cp35-abi3-manylinux1_i686.whl", hash = "sha256:f3bb267df679f70a9f40f17d62d22fe12e8b75e490f41807e7560de4d3e6bf9f"},
{file = "pycryptodomex-3.10.1-cp35-abi3-manylinux1_x86_64.whl", hash = "sha256:04265a7a84ae002001249bd1de2823bcf46832bd4b58f6965567cb8a07cf4f00"},
{file = "pycryptodomex-3.10.1-cp35-abi3-manylinux2010_i686.whl", hash = "sha256:72f44b5be46faef2a1bf2a85902511b31f4dd7b01ce0c3978e92edb2cc812a82"},
{file = "pycryptodomex-3.10.1-cp35-abi3-manylinux2010_x86_64.whl", hash = "sha256:e090a8609e2095aa86978559b140cf8968af99ee54b8791b29ff804838f29f10"},
{file = "pycryptodomex-3.10.1-cp35-abi3-manylinux2014_aarch64.whl", hash = "sha256:20c45a30f3389148f94edb77f3b216c677a277942f62a2b81a1cc0b6b2dde7fc"},
{file = "pycryptodomex-3.10.1-cp35-abi3-win32.whl", hash = "sha256:fc9c55dc1ed57db76595f2d19a479fc1c3a1be2c9da8de798a93d286c5f65f38"},
{file = "pycryptodomex-3.10.1-cp35-abi3-win_amd64.whl", hash = "sha256:3dfce70c4e425607ae87b8eae67c9c7dbba59a33b62d70f79417aef0bc5c735b"},
{file = "pycryptodomex-3.10.1-pp27-pypy_73-macosx_10_9_x86_64.whl", hash = "sha256:940db96449d7b2ebb2c7bf190be1514f3d67914bd37e54e8d30a182bd375a1a9"},
{file = "pycryptodomex-3.10.1-pp27-pypy_73-manylinux1_x86_64.whl", hash = "sha256:d8fae5ba3d34c868ae43614e0bd6fb61114b2687ac3255798791ce075d95aece"},
{file = "pycryptodomex-3.10.1-pp27-pypy_73-manylinux2010_x86_64.whl", hash = "sha256:f2abeb4c4ce7584912f4d637b2c57f23720d35dd2892bfeb1b2c84b6fb7a8c88"},
{file = "pycryptodomex-3.10.1-pp27-pypy_73-win32.whl", hash = "sha256:36dab7f506948056ceba2d57c1ade74e898401960de697cefc02f3519bd26c1b"},
{file = "pycryptodomex-3.10.1-pp36-pypy36_pp73-macosx_10_9_x86_64.whl", hash = "sha256:37ec1b407ec032c7a0c1fdd2da12813f560bad38ae61ad9c7ce3c0573b3e5e30"},
{file = "pycryptodomex-3.10.1-pp36-pypy36_pp73-manylinux1_x86_64.whl", hash = "sha256:00a584ee52bf5e27d540129ca9bf7c4a7e7447f24ff4a220faa1304ad0c09bcd"},
{file = "pycryptodomex-3.10.1-pp36-pypy36_pp73-manylinux2010_x86_64.whl", hash = "sha256:961333e7ee896651f02d4692242aa36b787b8e8e0baa2256717b2b9d55ae0a3c"},
{file = "pycryptodomex-3.10.1-pp36-pypy36_pp73-win32.whl", hash = "sha256:2959304d1ce31ab303d9fb5db2b294814278b35154d9b30bf7facc52d6088d0a"},
{file = "pycryptodomex-3.10.1.tar.gz", hash = "sha256:541cd3e3e252fb19a7b48f420b798b53483302b7fe4d9954c947605d0a263d62"},
]
pydantic = [
{file = "pydantic-1.8.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:0c40162796fc8d0aa744875b60e4dc36834db9f2a25dbf9ba9664b1915a23850"},
{file = "pydantic-1.8.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:fff29fe54ec419338c522b908154a2efabeee4f483e48990f87e189661f31ce3"},
@ -566,6 +839,21 @@ pyreadline = [
{file = "pyreadline-2.1.win32.exe", hash = "sha256:65540c21bfe14405a3a77e4c085ecfce88724743a4ead47c66b84defcf82c32e"},
{file = "pyreadline-2.1.zip", hash = "sha256:4530592fc2e85b25b1a9f79664433da09237c1a270e4d78ea5aa3a2c7229e2d1"},
]
python-dateutil = [
{file = "python-dateutil-2.8.1.tar.gz", hash = "sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c"},
{file = "python_dateutil-2.8.1-py2.py3-none-any.whl", hash = "sha256:75bb3f31ea686f1197762692a9ee6a7550b59fc6ca3a1f4b5d7e32fb98e2da2a"},
]
python-editor = [
{file = "python-editor-1.0.4.tar.gz", hash = "sha256:51fda6bcc5ddbbb7063b2af7509e43bd84bfc32a4ff71349ec7847713882327b"},
{file = "python_editor-1.0.4-py2-none-any.whl", hash = "sha256:5f98b069316ea1c2ed3f67e7f5df6c0d8f10b689964a4a811ff64f0106819ec8"},
{file = "python_editor-1.0.4-py2.7.egg", hash = "sha256:ea87e17f6ec459e780e4221f295411462e0d0810858e055fc514684350a2f522"},
{file = "python_editor-1.0.4-py3-none-any.whl", hash = "sha256:1bf6e860a8ad52a14c3ee1252d5dc25b2030618ed80c022598f00176adc8367d"},
{file = "python_editor-1.0.4-py3.5.egg", hash = "sha256:c3da2053dbab6b29c94e43c486ff67206eafbe7eb52dbec7390b5e2fb05aac77"},
]
requests = [
{file = "requests-2.15.1-py2.py3-none-any.whl", hash = "sha256:ff753b2196cd18b1bbeddc9dcd5c864056599f7a7d9a4fb5677e723efa2b7fb9"},
{file = "requests-2.15.1.tar.gz", hash = "sha256:e5659b9315a0610505e050bb7190bf6fa2ccee1ac295f2b760ef9d8a03ebbb2e"},
]
royalnet = [
{file = "royalnet-6.4.4-py3-none-any.whl", hash = "sha256:5530da162209db5f2021e342e4b57a5abf3a852a678034ab920c3480836e7d96"},
{file = "royalnet-6.4.4.tar.gz", hash = "sha256:4327b61e361d73845dc40785600d9aab5d62ae8e55e38dc3dcbf69570bd04d0f"},
@ -582,6 +870,10 @@ rsa = [
{file = "rsa-4.7.2-py3-none-any.whl", hash = "sha256:78f9a9bf4e7be0c5ded4583326e7461e3a3c5aae24073648b4bdfa797d78c9d2"},
{file = "rsa-4.7.2.tar.gz", hash = "sha256:9d689e6ca1b3038bc82bf8d23e944b6b6037bc02301a574935b2dd946e0353b9"},
]
six = [
{file = "six-1.15.0-py2.py3-none-any.whl", hash = "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"},
{file = "six-1.15.0.tar.gz", hash = "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"},
]
sqlalchemy = [
{file = "SQLAlchemy-1.4.8-cp27-cp27m-macosx_10_14_x86_64.whl", hash = "sha256:dec822c2a9436092798998475b3b8edd0d59be7fecdd5fb8411ac8db1575ed64"},
{file = "SQLAlchemy-1.4.8-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:15480706c51bdf72d726d0efde77eef6b5f09fbef65bc520f2c4e1f3a429fddf"},
@ -618,6 +910,12 @@ sqlalchemy = [
{file = "SQLAlchemy-1.4.8-cp39-cp39-win_amd64.whl", hash = "sha256:1e1c2c65f732f7740d184b4133e5207c0f8974663ab1b79ce1b599ecf55bd3e9"},
{file = "SQLAlchemy-1.4.8.tar.gz", hash = "sha256:3bc31ad707f8587c9f93d50cd7cee80ba352162d322808ddbb5bcb5fcfd2bb83"},
]
sqlalchemy-utils = [
{file = "SQLAlchemy_Utils-0.37.0-py2.py3-none-any.whl", hash = "sha256:c7bec2c982b31ec6133ba519f73f07653bbb7e7b3c23836bb8d9133045386b68"},
]
steam = [
{file = "steam-1.2.0.tar.gz", hash = "sha256:24210084852ebd2ff13275e0a37d0c2294b965f8078c3a505636c499b5575e7f"},
]
telethon = [
{file = "Telethon-1.21.1-py3-none-any.whl", hash = "sha256:df643fc988708ad16d16de834ffa12ad4bfa3f956473d835c8158e2283b885ea"},
{file = "Telethon-1.21.1.tar.gz", hash = "sha256:993c837ef745addf972a27d7bfba0ce518a2863d1a50e0737255b764d23e0ef2"},
@ -631,6 +929,10 @@ typing-extensions = [
{file = "typing_extensions-3.7.4.3-py3-none-any.whl", hash = "sha256:7cb407020f00f7bfc3cb3e7881628838e69d8f3fcab2f64742a5e76b2f841918"},
{file = "typing_extensions-3.7.4.3.tar.gz", hash = "sha256:99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c"},
]
vdf = [
{file = "vdf-3.3-py2.py3-none-any.whl", hash = "sha256:f88db3a3e66e7264da7fdacf0ffa1d99be52dd30510b2c1a1340171b227472e4"},
{file = "vdf-3.3.tar.gz", hash = "sha256:9193901ce20ee08391c1d5044234b5da021d939b00ce879f5aae0a1a759577bc"},
]
yarl = [
{file = "yarl-1.6.3-cp36-cp36m-macosx_10_14_x86_64.whl", hash = "sha256:0355a701b3998dcd832d0dc47cc5dedf3874f966ac7f870e0f3a6788d802d434"},
{file = "yarl-1.6.3-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:bafb450deef6861815ed579c7a6113a879a6ef58aed4c3a4be54400ae8871478"},

View file

@ -22,6 +22,11 @@ psycopg2 = "^2.8.6"
royalnet = "~6.4.4"
royalnet_telethon = "^1.0.2"
royalnet_console = "^2.0.3"
alembic = "^1.5.8"
steam = "^1.2.0"
SQLAlchemy-Utils = "^0.37.0"
arrow = "^1.0.3"
colour = "^0.1.5"
[tool.poetry.dev-dependencies]

View file

@ -0,0 +1 @@
Generic single-database configuration.

View file

@ -0,0 +1,65 @@
import logging.config
import sqlalchemy
import sqlalchemy.pool
import alembic
from royalpack.database.base import Base
from royalpack.database.engine import lazy_engine
from royalpack.config import lazy_config
# Set up logging
logging.config.fileConfig(alembic.context.config.config_file_name)
# Get the metadata
target_metadata = Base.metadata
def run_migrations_offline():
"""Run migrations in 'offline' mode.
This configures the context with just a URL
and not an Engine, though an Engine is acceptable
here as well. By skipping the Engine creation
we don't even need a DBAPI to be available.
Calls to context.execute() here emit the given string to the
script output.
"""
royalpack_config = lazy_config.evaluate()
alembic.context.configure(
url=royalpack_config["database.uri"],
target_metadata=target_metadata,
literal_binds=True,
dialect_opts={"paramstyle": "named"},
)
with alembic.context.begin_transaction():
alembic.context.run_migrations()
def run_migrations_online():
"""Run migrations in 'online' mode.
In this scenario we need to create an Engine
and associate a connection with the context.
"""
engine = lazy_engine.evaluate()
with engine.connect() as connection:
alembic.context.configure(
connection=connection, target_metadata=target_metadata
)
with alembic.context.begin_transaction():
alembic.context.run_migrations()
if alembic.context.is_offline_mode():
run_migrations_offline()
else:
run_migrations_online()

View file

@ -0,0 +1,24 @@
"""${message}
Revision ID: ${up_revision}
Revises: ${down_revision | comma,n}
Create Date: ${create_date}
"""
from alembic import op
import sqlalchemy as sa
${imports if imports else ""}
# revision identifiers, used by Alembic.
revision = ${repr(up_revision)}
down_revision = ${repr(down_revision)}
branch_labels = ${repr(branch_labels)}
depends_on = ${repr(depends_on)}
def upgrade():
${upgrades if upgrades else "pass"}
def downgrade():
${downgrades if downgrades else "pass"}

View file

@ -0,0 +1,158 @@
"""Second revision
Revision ID: 8b28a4a94552
Revises:
Create Date: 2021-04-18 00:38:17.976303
"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
# revision identifiers, used by Alembic.
revision = '8b28a4a94552'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('titles',
sa.Column('uuid', sqlalchemy_utils.types.uuid.UUIDType(), nullable=False),
sa.Column('name', sa.String(), nullable=False),
sa.Column('visible', sa.Boolean(), nullable=False),
sa.Column('locked_description', sa.Text(), nullable=False),
sa.Column('unlocked_description', sa.Text(), nullable=False),
sa.PrimaryKeyConstraint('uuid')
)
op.create_table('users',
sa.Column('sub', sa.String(), nullable=False),
sa.Column('last_update', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
sa.Column('name', sa.String(), nullable=False),
sa.Column('nickname', sa.String(), nullable=False),
sa.Column('avatar', sa.String(), nullable=False),
sa.Column('email', sa.String(), nullable=False),
sa.Column('bio', sa.Text(), nullable=False),
sa.Column('color', sqlalchemy_utils.types.color.ColorType(length=20), nullable=False),
sa.Column('title_fk', sqlalchemy_utils.types.uuid.UUIDType(), nullable=True),
sa.Column('fiorygi', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['title_fk'], ['titles.uuid'], ),
sa.PrimaryKeyConstraint('sub')
)
op.create_table('accounts_discord',
sa.Column('user_fk', sa.String(), nullable=False),
sa.Column('id', sa.BigInteger(), nullable=False),
sa.Column('username', sa.String(), nullable=False),
sa.Column('discriminator', sa.SmallInteger(), nullable=False),
sa.Column('avatar_url', sqlalchemy_utils.types.url.URLType(), nullable=True),
sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('accounts_league',
sa.Column('user_fk', sa.String(), nullable=False),
sa.Column('region', sa.String(), nullable=False),
sa.Column('puuid', sa.String(), nullable=False),
sa.Column('summoner_name', sa.String(), nullable=False),
sa.Column('avatar_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ),
sa.PrimaryKeyConstraint('puuid')
)
op.create_table('accounts_osu',
sa.Column('user_fk', sa.String(), nullable=False),
sa.Column('id', sa.BigInteger(), nullable=False),
sa.Column('username', sa.String(), nullable=True),
sa.Column('avatar_url', sqlalchemy_utils.types.url.URLType(), nullable=True),
sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('accounts_steam',
sa.Column('user_fk', sa.String(), nullable=False),
sa.Column('steamid', sa.BigInteger(), nullable=False),
sa.Column('persona_name', sa.String(), nullable=False),
sa.Column('avatar_url', sqlalchemy_utils.types.url.URLType(), nullable=True),
sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ),
sa.PrimaryKeyConstraint('steamid')
)
op.create_table('accounts_telegram',
sa.Column('user_fk', sa.String(), nullable=False),
sa.Column('id', sa.BigInteger(), nullable=False),
sa.Column('first_name', sa.String(), nullable=False),
sa.Column('last_name', sa.String(), nullable=True),
sa.Column('username', sa.String(), nullable=True),
sa.Column('avatar_url', sqlalchemy_utils.types.url.URLType(), nullable=True),
sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('diario_groups',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('saved_by_fk', sa.String(), nullable=False),
sa.Column('context', sa.Text(), nullable=True),
sa.ForeignKeyConstraint(['saved_by_fk'], ['users.sub'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('fiorygi_transactions',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('minus_fk', sa.String(), nullable=True),
sa.Column('plus_fk', sa.String(), nullable=True),
sa.Column('amount', sa.Integer(), nullable=False),
sa.Column('reason', sa.Text(), nullable=True),
sa.ForeignKeyConstraint(['minus_fk'], ['users.sub'], ),
sa.ForeignKeyConstraint(['plus_fk'], ['users.sub'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('fiorygi_treasures',
sa.Column('slug', sa.String(), nullable=False),
sa.Column('creator_fk', sa.String(), nullable=True),
sa.Column('finder_fk', sa.String(), nullable=True),
sa.Column('value', sa.Integer(), nullable=False),
sa.Column('message', sa.Text(), nullable=True),
sa.ForeignKeyConstraint(['creator_fk'], ['users.sub'], ),
sa.ForeignKeyConstraint(['finder_fk'], ['users.sub'], ),
sa.PrimaryKeyConstraint('slug')
)
op.create_table('user_aliases',
sa.Column('user_fk', sa.String(), nullable=False),
sa.Column('name', sa.String(), nullable=False),
sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ),
sa.PrimaryKeyConstraint('user_fk')
)
op.create_table('user_title_association',
sa.Column('user_fk', sa.String(), nullable=True),
sa.Column('title_fk', sqlalchemy_utils.types.uuid.UUIDType(), nullable=True),
sa.ForeignKeyConstraint(['title_fk'], ['titles.uuid'], ),
sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], )
)
op.create_table('diario_lines',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('diario_group_fk', sa.Integer(), nullable=False),
sa.Column('text', sa.Text(), nullable=True),
sa.Column('media_url', sqlalchemy_utils.types.url.URLType(), nullable=True),
sa.Column('timestamp', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True),
sa.Column('spoiler', sa.String(), nullable=True),
sa.Column('quoted_str', sa.String(), nullable=True),
sa.Column('quoted_user_fk', sa.String(), nullable=True),
sa.ForeignKeyConstraint(['diario_group_fk'], ['diario_groups.id'], ),
sa.ForeignKeyConstraint(['quoted_user_fk'], ['users.sub'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('diario_lines')
op.drop_table('user_title_association')
op.drop_table('user_aliases')
op.drop_table('fiorygi_treasures')
op.drop_table('fiorygi_transactions')
op.drop_table('diario_groups')
op.drop_table('accounts_telegram')
op.drop_table('accounts_steam')
op.drop_table('accounts_osu')
op.drop_table('accounts_league')
op.drop_table('accounts_discord')
op.drop_table('users')
op.drop_table('titles')
# ### end Alembic commands ###

View file

@ -1,10 +1,230 @@
from __future__ import annotations
import sqlalchemy as s
import sqlalchemy.orm as so
import sqlalchemy.ext.declarative as sed
import sqlalchemy.ext.associationproxy as seap
import sqlalchemy_utils as su
import royalnet.alchemist as ra
import colour
Base: sed.declarative_base = sed.declarative_base()
__all__ = (
"Base",
user_title_association = s.Table(
"user_title_association",
Base.metadata,
s.Column("user_fk", s.String, s.ForeignKey("users.sub")),
s.Column("title_fk", su.UUIDType, s.ForeignKey("titles.uuid"))
)
class User(Base, ra.ColRepr, ra.Updatable):
"""
An user, as returned by Auth0.
"""
__tablename__ = "users"
sub = s.Column(s.String, primary_key=True)
last_update = s.Column(su.ArrowType, nullable=False)
name = s.Column(s.String, nullable=False)
nickname = s.Column(s.String, nullable=False)
avatar = s.Column(s.String, nullable=False)
email = s.Column(s.String, nullable=False)
bio = s.Column(s.Text, nullable=False, default="")
color = s.Column(su.ColorType, nullable=False, default=colour.Color("#a0ccff"))
title_fk = s.Column(su.UUIDType, s.ForeignKey("titles.uuid"))
fiorygi = s.Column(s.Integer, nullable=False, default=0)
class UserAlias(Base, ra.ColRepr, ra.Updatable):
"""
An alias for an User.
"""
__tablename__ = "user_aliases"
user_fk = s.Column(s.String, s.ForeignKey("users.sub"), primary_key=True)
user = so.relationship("User", backref="aliases")
name = s.Column(s.String, nullable=False)
class TelegramAccount(Base, ra.ColRepr, ra.Updatable):
"""
A Telegram account.
"""
__tablename__ = "accounts_telegram"
user_fk = s.Column(s.String, s.ForeignKey("users.sub"), nullable=False)
user = so.relationship("User", backref="telegram_accounts")
id = s.Column(s.BigInteger, primary_key=True)
first_name = s.Column(s.String, nullable=False)
last_name = s.Column(s.String)
username = s.Column(s.String)
avatar_url = s.Column(su.URLType)
def name(self) -> str:
if self.username is not None:
return f"{self.username}"
elif self.last_name is not None:
return f"{self.first_name} {self.last_name}"
else:
return f"{self.first_name}"
def mention(self) -> str:
if self.username is not None:
return f"@{self.username}"
else:
return f"[{self.name}](tg://user?id={self.tg_id})"
class DiscordAccount(Base, ra.ColRepr, ra.Updatable):
"""
A Discord account.
"""
__tablename__ = "accounts_discord"
user_fk = s.Column(s.String, s.ForeignKey("users.sub"), nullable=False)
user = so.relationship("User", backref="discord_accounts")
id = s.Column(s.BigInteger, primary_key=True)
username = s.Column(s.String, nullable=False)
discriminator = s.Column(s.SmallInteger, nullable=False)
avatar_url = s.Column(su.URLType)
def name(self) -> str:
return f"{self.username}#{self.discriminator}"
class SteamAccount(Base, ra.ColRepr, ra.Updatable):
"""
A Steam account.
"""
__tablename__ = "accounts_steam"
user_fk = s.Column(s.String, s.ForeignKey("users.sub"), nullable=False)
user = so.relationship("User", backref="steam_accounts")
steamid = s.Column(s.BigInteger, primary_key=True)
persona_name = s.Column(s.String, nullable=False)
avatar_url = s.Column(su.URLType)
# TODO: make steamid return steam.steamid.SteamID objects
class OsuAccount(Base, ra.ColRepr, ra.Updatable):
"""
An osu! account.
"""
__tablename__ = "accounts_osu"
user_fk = s.Column(s.String, s.ForeignKey("users.sub"), nullable=False)
user = so.relationship("User", backref="osu_accounts")
id = s.Column(s.BigInteger, primary_key=True)
username = s.Column(s.String)
avatar_url = s.Column(su.URLType)
class LeagueAccount(Base, ra.ColRepr, ra.Updatable):
"""
A League of Legends account.
"""
__tablename__ = "accounts_league"
user_fk = s.Column(s.String, s.ForeignKey("users.sub"), nullable=False)
user = so.relationship("User", backref="league_accounts")
region = s.Column(s.String, nullable=False)
puuid = s.Column(s.String, primary_key=True)
summoner_name = s.Column(s.String, nullable=False)
avatar_id = s.Column(s.Integer, nullable=False)
class Title(Base, ra.ColRepr, ra.Updatable):
"""
Title available for users to unlock.
"""
__tablename__ = "titles"
uuid = s.Column(su.UUIDType, primary_key=True)
name = s.Column(s.String, nullable=False)
visible = s.Column(s.Boolean, nullable=False)
locked_description = s.Column(s.Text, nullable=False)
unlocked_description = s.Column(s.Text, nullable=False)
unlocked_by = so.relationship("User", secondary=user_title_association, backref="unlocked_titles")
class DiarioGroup(Base, ra.ColRepr, ra.Updatable):
"""
Group of Diario entries.
"""
__tablename__ = "diario_groups"
id = s.Column(s.Integer, primary_key=True)
saved_by_fk = s.Column(s.String, s.ForeignKey("users.sub"), nullable=False)
saved_by = so.relationship("User", backref="diario_groups_saved")
context = s.Column(s.Text)
class DiarioLine(Base, ra.ColRepr, ra.Updatable):
"""
Single Diario quote.
"""
__tablename__ = "diario_lines"
id = s.Column(s.Integer, primary_key=True)
diario_group_fk = s.Column(s.Integer, s.ForeignKey("diario_groups.id"), nullable=False)
diario_group = so.relationship("DiarioGroup", backref="lines")
text = s.Column(s.Text)
media_url = s.Column(su.URLType)
timestamp = s.Column(su.ArrowType)
spoiler = s.Column(s.String)
quoted_str = s.Column(s.String)
quoted_user_fk = s.Column(s.String, s.ForeignKey("users.sub"))
quoted_user = so.relationship("DiarioGroup", backref="diario_quoted_in")
class Transaction(Base, ra.ColRepr, ra.Updatable):
"""
Single fiorygi transaction.
"""
__tablename__ = "fiorygi_transactions"
id = s.Column(s.Integer, primary_key=True)
minus_fk = s.Column(s.String, s.ForeignKey("users.sub"))
minus = so.relationship("User", foreign_keys=(minus_fk,))
plus_fk = s.Column(s.String, s.ForeignKey("users.sub"))
plus = so.relationship("User", foreign_keys=(plus_fk,))
amount = s.Column(s.Integer, nullable=False)
reason = s.Column(s.Text)
class Treasure(Base, ra.ColRepr, ra.Updatable):
"""
A treasure code which rewards fiorygi.
"""
__tablename__ = "fiorygi_treasures"
slug = s.Column(s.String, primary_key=True)
creator_fk = s.Column(s.String, s.ForeignKey("users.sub"))
creator = so.relationship("User", foreign_keys=(creator_fk,))
finder_fk = s.Column(s.String, s.ForeignKey("users.sub"))
finder = so.relationship("User", foreign_keys=(finder_fk,))
value = s.Column(s.Integer, nullable=False)
message = s.Column(s.Text)

View file

@ -3,9 +3,6 @@ import royalnet.lazy
from ..config import *
# noinspection PyUnresolvedReferences
from . import tables
lazy_engine = royalnet.lazy.Lazy(lambda c: sqlalchemy.create_engine(c["database.uri"]), c=lazy_config)
"""

View file

@ -1 +0,0 @@
from .rage import *

View file

@ -1,19 +0,0 @@
from ..base import Base
import royalnet.royaltyping as t
import royalnet.alchemist as a
import sqlalchemy as s
import sqlalchemy.orm as o
import datetime
__all__ = (
"Base",
"t",
"a",
"s",
"o",
"datetime",
)

View file

@ -1,15 +0,0 @@
from __future__ import annotations
from ._imports import *
class Rage(Base):
__tablename__ = "rage"
id = s.Column(s.Integer, primary_key=True)
reason = s.Column(s.Text, nullable=False)
__all__ = (
"Rage",
)