init
This commit is contained in:
		
							
								
								
									
										143
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										143
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,143 @@ | |||||||
|  | # Created by .ignore support plugin (hsz.mobi) | ||||||
|  | ### Python template | ||||||
|  | # Byte-compiled / optimized / DLL files | ||||||
|  | __pycache__/ | ||||||
|  | *.py[cod] | ||||||
|  | *$py.class | ||||||
|  |  | ||||||
|  | # C extensions | ||||||
|  | *.so | ||||||
|  |  | ||||||
|  | # Distribution / packaging | ||||||
|  | .Python | ||||||
|  | build/ | ||||||
|  | develop-eggs/ | ||||||
|  | dist/ | ||||||
|  | downloads/ | ||||||
|  | eggs/ | ||||||
|  | .eggs/ | ||||||
|  | lib/ | ||||||
|  | lib64/ | ||||||
|  | parts/ | ||||||
|  | sdist/ | ||||||
|  | var/ | ||||||
|  | wheels/ | ||||||
|  | pip-wheel-metadata/ | ||||||
|  | share/python-wheels/ | ||||||
|  | *.egg-info/ | ||||||
|  | .installed.cfg | ||||||
|  | *.egg | ||||||
|  | MANIFEST | ||||||
|  |  | ||||||
|  | # PyInstaller | ||||||
|  | #  Usually these files are written by a python script from a template | ||||||
|  | #  before PyInstaller builds the exe, so as to inject date/other infos into it. | ||||||
|  | *.manifest | ||||||
|  | *.spec | ||||||
|  |  | ||||||
|  | # Installer logs | ||||||
|  | pip-log.txt | ||||||
|  | pip-delete-this-directory.txt | ||||||
|  |  | ||||||
|  | # Unit test / coverage reports | ||||||
|  | htmlcov/ | ||||||
|  | .tox/ | ||||||
|  | .nox/ | ||||||
|  | .coverage | ||||||
|  | .coverage.* | ||||||
|  | .cache | ||||||
|  | nosetests.xml | ||||||
|  | coverage.xml | ||||||
|  | *.cover | ||||||
|  | *.py,cover | ||||||
|  | .hypothesis/ | ||||||
|  | .pytest_cache/ | ||||||
|  | cover/ | ||||||
|  |  | ||||||
|  | # Translations | ||||||
|  | *.mo | ||||||
|  | *.pot | ||||||
|  |  | ||||||
|  | # Django stuff: | ||||||
|  | *.log | ||||||
|  | local_settings.py | ||||||
|  | db.sqlite3 | ||||||
|  | db.sqlite3-journal | ||||||
|  |  | ||||||
|  | # Flask stuff: | ||||||
|  | instance/ | ||||||
|  | .webassets-cache | ||||||
|  |  | ||||||
|  | # Scrapy stuff: | ||||||
|  | .scrapy | ||||||
|  |  | ||||||
|  | # Sphinx documentation | ||||||
|  | docs/_build/ | ||||||
|  |  | ||||||
|  | # PyBuilder | ||||||
|  | .pybuilder/ | ||||||
|  | target/ | ||||||
|  |  | ||||||
|  | # Jupyter Notebook | ||||||
|  | .ipynb_checkpoints | ||||||
|  |  | ||||||
|  | # IPython | ||||||
|  | profile_default/ | ||||||
|  | ipython_config.py | ||||||
|  |  | ||||||
|  | # pyenv | ||||||
|  | #   For a library or package, you might want to ignore these files since the code is | ||||||
|  | #   intended to run in multiple environments; otherwise, check them in: | ||||||
|  | # .python-version | ||||||
|  |  | ||||||
|  | # pipenv | ||||||
|  | #   According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||||||
|  | #   However, in case of collaboration, if having platform-specific dependencies or dependencies | ||||||
|  | #   having no cross-platform support, pipenv may install dependencies that don't work, or not | ||||||
|  | #   install all needed dependencies. | ||||||
|  | #Pipfile.lock | ||||||
|  |  | ||||||
|  | # PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||||||
|  | __pypackages__/ | ||||||
|  |  | ||||||
|  | # Celery stuff | ||||||
|  | celerybeat-schedule | ||||||
|  | celerybeat.pid | ||||||
|  |  | ||||||
|  | # SageMath parsed files | ||||||
|  | *.sage.py | ||||||
|  |  | ||||||
|  | # Environments | ||||||
|  | .env | ||||||
|  | .venv | ||||||
|  | env/ | ||||||
|  | venv/ | ||||||
|  | ENV/ | ||||||
|  | env.bak/ | ||||||
|  | venv.bak/ | ||||||
|  |  | ||||||
|  | # Spyder project settings | ||||||
|  | .spyderproject | ||||||
|  | .spyproject | ||||||
|  |  | ||||||
|  | # Rope project settings | ||||||
|  | .ropeproject | ||||||
|  |  | ||||||
|  | # mkdocs documentation | ||||||
|  | /site | ||||||
|  |  | ||||||
|  | # mypy | ||||||
|  | .mypy_cache/ | ||||||
|  | .dmypy.json | ||||||
|  | dmypy.json | ||||||
|  |  | ||||||
|  | # Pyre type checker | ||||||
|  | .pyre/ | ||||||
|  |  | ||||||
|  | # pytype static type analyzer | ||||||
|  | .pytype/ | ||||||
|  |  | ||||||
|  | # Cython debug symbols | ||||||
|  | cython_debug/ | ||||||
|  |  | ||||||
|  | .idea | ||||||
							
								
								
									
										0
									
								
								README.rst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								README.rst
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										9
									
								
								alice/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								alice/__init__.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | |||||||
|  | __version__ = '0.1.0' | ||||||
|  |  | ||||||
|  |  | ||||||
|  | def main(): | ||||||
|  |     pass | ||||||
|  |  | ||||||
|  |  | ||||||
|  | if __name__ == '__main__': | ||||||
|  |     main() | ||||||
							
								
								
									
										36
									
								
								alice/backends/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								alice/backends/__init__.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | |||||||
|  | from typing import Type | ||||||
|  |  | ||||||
|  | from tortoise import Model, BaseDBAsyncClient | ||||||
|  | from tortoise.backends.base.schema_generator import BaseSchemaGenerator | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class DDL: | ||||||
|  |     schema_generator_cls: Type[BaseSchemaGenerator] = BaseSchemaGenerator | ||||||
|  |  | ||||||
|  |     def __init__(self, client: "BaseDBAsyncClient", model: "Type[Model]"): | ||||||
|  |         self.model = model | ||||||
|  |         self.schema_generator = self.schema_generator_cls(client) | ||||||
|  |  | ||||||
|  |     def create_table(self): | ||||||
|  |         return self.schema_generator._get_table_sql(self.model, True)['table_creation_string'] | ||||||
|  |  | ||||||
|  |     def drop_table(self): | ||||||
|  |         return f'drop table {self.model._meta.db_table}' | ||||||
|  |  | ||||||
|  |     def add_column(self): | ||||||
|  |         raise NotImplementedError() | ||||||
|  |  | ||||||
|  |     def drop_column(self): | ||||||
|  |         raise NotImplementedError() | ||||||
|  |  | ||||||
|  |     def add_index(self): | ||||||
|  |         raise NotImplementedError() | ||||||
|  |  | ||||||
|  |     def drop_index(self): | ||||||
|  |         raise NotImplementedError() | ||||||
|  |  | ||||||
|  |     def add_fk(self): | ||||||
|  |         raise NotImplementedError() | ||||||
|  |  | ||||||
|  |     def drop_fk(self): | ||||||
|  |         raise NotImplementedError() | ||||||
							
								
								
									
										28
									
								
								alice/backends/mysql/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								alice/backends/mysql/__init__.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | |||||||
|  | from tortoise.backends.mysql.schema_generator import MySQLSchemaGenerator | ||||||
|  |  | ||||||
|  | from alice.backends import DDL | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class MysqlDDL(DDL): | ||||||
|  |     schema_generator_cls = MySQLSchemaGenerator | ||||||
|  |  | ||||||
|  |     def drop_table(self): | ||||||
|  |         pass | ||||||
|  |  | ||||||
|  |     def add_column(self): | ||||||
|  |         pass | ||||||
|  |  | ||||||
|  |     def drop_column(self): | ||||||
|  |         pass | ||||||
|  |  | ||||||
|  |     def add_index(self): | ||||||
|  |         pass | ||||||
|  |  | ||||||
|  |     def drop_index(self): | ||||||
|  |         pass | ||||||
|  |  | ||||||
|  |     def add_fk(self): | ||||||
|  |         pass | ||||||
|  |  | ||||||
|  |     def drop_fk(self): | ||||||
|  |         pass | ||||||
							
								
								
									
										18
									
								
								alice/cmd.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								alice/cmd.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | |||||||
|  | class CommandLine: | ||||||
|  |     def __init__(self, argv): | ||||||
|  |         self.argv = argv | ||||||
|  |  | ||||||
|  |     def migrate(self): | ||||||
|  |         pass | ||||||
|  |  | ||||||
|  |     def upgrade(self): | ||||||
|  |         pass | ||||||
|  |  | ||||||
|  |     def downgrade(self): | ||||||
|  |         pass | ||||||
|  |  | ||||||
|  |     def init_db(self): | ||||||
|  |         pass | ||||||
|  |  | ||||||
|  |     def init(self): | ||||||
|  |         pass | ||||||
							
								
								
									
										0
									
								
								alice/diff.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								alice/diff.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										263
									
								
								poetry.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										263
									
								
								poetry.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,263 @@ | |||||||
|  | [[package]] | ||||||
|  | category = "main" | ||||||
|  | description = "MySQL driver for asyncio." | ||||||
|  | name = "aiomysql" | ||||||
|  | optional = false | ||||||
|  | python-versions = "*" | ||||||
|  | version = "0.0.20" | ||||||
|  |  | ||||||
|  | [package.dependencies] | ||||||
|  | PyMySQL = ">=0.9,<=0.9.2" | ||||||
|  |  | ||||||
|  | [package.extras] | ||||||
|  | sa = ["sqlalchemy (>=1.0)"] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | category = "main" | ||||||
|  | description = "asyncio bridge to the standard sqlite3 module" | ||||||
|  | name = "aiosqlite" | ||||||
|  | optional = false | ||||||
|  | python-versions = ">=3.6" | ||||||
|  | version = "0.13.0" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | category = "dev" | ||||||
|  | description = "Enhance the standard unittest package with features for testing asyncio libraries" | ||||||
|  | name = "asynctest" | ||||||
|  | optional = false | ||||||
|  | python-versions = ">=3.5" | ||||||
|  | version = "0.13.0" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | category = "main" | ||||||
|  | description = "Foreign Function Interface for Python calling C code." | ||||||
|  | name = "cffi" | ||||||
|  | optional = false | ||||||
|  | python-versions = "*" | ||||||
|  | version = "1.14.0" | ||||||
|  |  | ||||||
|  | [package.dependencies] | ||||||
|  | pycparser = "*" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | category = "main" | ||||||
|  | description = "Fast ISO8601 date time parser for Python written in C" | ||||||
|  | marker = "sys_platform != \"win32\" and implementation_name == \"cpython\"" | ||||||
|  | name = "ciso8601" | ||||||
|  | optional = false | ||||||
|  | python-versions = "*" | ||||||
|  | version = "2.1.3" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | category = "main" | ||||||
|  | description = "cryptography is a package which provides cryptographic recipes and primitives to Python developers." | ||||||
|  | name = "cryptography" | ||||||
|  | optional = false | ||||||
|  | python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*" | ||||||
|  | version = "2.9.2" | ||||||
|  |  | ||||||
|  | [package.dependencies] | ||||||
|  | cffi = ">=1.8,<1.11.3 || >1.11.3" | ||||||
|  | six = ">=1.4.1" | ||||||
|  |  | ||||||
|  | [package.extras] | ||||||
|  | docs = ["sphinx (>=1.6.5,<1.8.0 || >1.8.0)", "sphinx-rtd-theme"] | ||||||
|  | docstest = ["doc8", "pyenchant (>=1.6.11)", "twine (>=1.12.0)", "sphinxcontrib-spelling (>=4.0.1)"] | ||||||
|  | idna = ["idna (>=2.1)"] | ||||||
|  | pep8test = ["flake8", "flake8-import-order", "pep8-naming"] | ||||||
|  | test = ["pytest (>=3.6.0,<3.9.0 || >3.9.0,<3.9.1 || >3.9.1,<3.9.2 || >3.9.2)", "pretend", "iso8601", "pytz", "hypothesis (>=1.11.4,<3.79.2 || >3.79.2)"] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | category = "main" | ||||||
|  | description = "Simple module to parse ISO 8601 dates" | ||||||
|  | marker = "sys_platform == \"win32\" or implementation_name != \"cpython\"" | ||||||
|  | name = "iso8601" | ||||||
|  | optional = false | ||||||
|  | python-versions = "*" | ||||||
|  | version = "0.1.12" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | category = "main" | ||||||
|  | description = "C parser in Python" | ||||||
|  | name = "pycparser" | ||||||
|  | optional = false | ||||||
|  | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" | ||||||
|  | version = "2.20" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | category = "main" | ||||||
|  | description = "Pure Python MySQL Driver" | ||||||
|  | name = "pymysql" | ||||||
|  | optional = false | ||||||
|  | python-versions = "*" | ||||||
|  | version = "0.9.2" | ||||||
|  |  | ||||||
|  | [package.dependencies] | ||||||
|  | cryptography = "*" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | category = "main" | ||||||
|  | description = "A SQL query builder API for Python" | ||||||
|  | name = "pypika" | ||||||
|  | optional = false | ||||||
|  | python-versions = "*" | ||||||
|  | version = "0.37.6" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | category = "main" | ||||||
|  | description = "Python 2 and 3 compatibility utilities" | ||||||
|  | name = "six" | ||||||
|  | optional = false | ||||||
|  | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" | ||||||
|  | version = "1.14.0" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | category = "dev" | ||||||
|  | description = "tasks runner for python projects" | ||||||
|  | name = "taskipy" | ||||||
|  | optional = false | ||||||
|  | python-versions = ">=3.6,<4.0" | ||||||
|  | version = "1.2.1" | ||||||
|  |  | ||||||
|  | [package.dependencies] | ||||||
|  | toml = ">=0.10.0,<0.11.0" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | category = "dev" | ||||||
|  | description = "Python Library for Tom's Obvious, Minimal Language" | ||||||
|  | name = "toml" | ||||||
|  | optional = false | ||||||
|  | python-versions = "*" | ||||||
|  | version = "0.10.0" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | category = "main" | ||||||
|  | description = "Easy async ORM for python, built with relations in mind" | ||||||
|  | name = "tortoise-orm" | ||||||
|  | optional = false | ||||||
|  | python-versions = "*" | ||||||
|  | version = "0.16.10" | ||||||
|  |  | ||||||
|  | [package.dependencies] | ||||||
|  | aiosqlite = ">=0.11.0" | ||||||
|  | ciso8601 = ">=2.1.2" | ||||||
|  | iso8601 = ">=0.1.12" | ||||||
|  | pypika = ">=0.36.5" | ||||||
|  | typing-extensions = ">=3.7" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | category = "main" | ||||||
|  | description = "Backported and Experimental Type Hints for Python 3.5+" | ||||||
|  | name = "typing-extensions" | ||||||
|  | optional = false | ||||||
|  | python-versions = "*" | ||||||
|  | version = "3.7.4.2" | ||||||
|  |  | ||||||
|  | [metadata] | ||||||
|  | content-hash = "e8e49dcc243fcd3a31fd60ee5a637af7b265c4fea2078a48d2bd7f10794fe323" | ||||||
|  | python-versions = "^3.8" | ||||||
|  |  | ||||||
|  | [metadata.files] | ||||||
|  | aiomysql = [ | ||||||
|  |     {file = "aiomysql-0.0.20-py3-none-any.whl", hash = "sha256:5fd798481f16625b424eec765c56d712ac78a51f3bd0175a3de94107aae43307"}, | ||||||
|  |     {file = "aiomysql-0.0.20.tar.gz", hash = "sha256:d89ce25d44dadb43cf2d9e4603bd67b7a0ad12d5e67208de013629ba648df2ba"}, | ||||||
|  | ] | ||||||
|  | aiosqlite = [ | ||||||
|  |     {file = "aiosqlite-0.13.0-py3-none-any.whl", hash = "sha256:50688c40632ae249f986ab3ae2c66a45c0535b84a5d4aae0e0be572b5fed6909"}, | ||||||
|  |     {file = "aiosqlite-0.13.0.tar.gz", hash = "sha256:6e92961ae9e606b43b05e29b129e346b29e400fcbd63e3c0c564d89230257645"}, | ||||||
|  | ] | ||||||
|  | asynctest = [ | ||||||
|  |     {file = "asynctest-0.13.0-py3-none-any.whl", hash = "sha256:5da6118a7e6d6b54d83a8f7197769d046922a44d2a99c21382f0a6e4fadae676"}, | ||||||
|  |     {file = "asynctest-0.13.0.tar.gz", hash = "sha256:c27862842d15d83e6a34eb0b2866c323880eb3a75e4485b079ea11748fd77fac"}, | ||||||
|  | ] | ||||||
|  | cffi = [ | ||||||
|  |     {file = "cffi-1.14.0-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:1cae98a7054b5c9391eb3249b86e0e99ab1e02bb0cc0575da191aedadbdf4384"}, | ||||||
|  |     {file = "cffi-1.14.0-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:cf16e3cf6c0a5fdd9bc10c21687e19d29ad1fe863372b5543deaec1039581a30"}, | ||||||
|  |     {file = "cffi-1.14.0-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:f2b0fa0c01d8a0c7483afd9f31d7ecf2d71760ca24499c8697aeb5ca37dc090c"}, | ||||||
|  |     {file = "cffi-1.14.0-cp27-cp27m-win32.whl", hash = "sha256:99f748a7e71ff382613b4e1acc0ac83bf7ad167fb3802e35e90d9763daba4d78"}, | ||||||
|  |     {file = "cffi-1.14.0-cp27-cp27m-win_amd64.whl", hash = "sha256:c420917b188a5582a56d8b93bdd8e0f6eca08c84ff623a4c16e809152cd35793"}, | ||||||
|  |     {file = "cffi-1.14.0-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:399aed636c7d3749bbed55bc907c3288cb43c65c4389964ad5ff849b6370603e"}, | ||||||
|  |     {file = "cffi-1.14.0-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:cab50b8c2250b46fe738c77dbd25ce017d5e6fb35d3407606e7a4180656a5a6a"}, | ||||||
|  |     {file = "cffi-1.14.0-cp35-cp35m-macosx_10_9_x86_64.whl", hash = "sha256:001bf3242a1bb04d985d63e138230802c6c8d4db3668fb545fb5005ddf5bb5ff"}, | ||||||
|  |     {file = "cffi-1.14.0-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:e56c744aa6ff427a607763346e4170629caf7e48ead6921745986db3692f987f"}, | ||||||
|  |     {file = "cffi-1.14.0-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:b8c78301cefcf5fd914aad35d3c04c2b21ce8629b5e4f4e45ae6812e461910fa"}, | ||||||
|  |     {file = "cffi-1.14.0-cp35-cp35m-win32.whl", hash = "sha256:8c0ffc886aea5df6a1762d0019e9cb05f825d0eec1f520c51be9d198701daee5"}, | ||||||
|  |     {file = "cffi-1.14.0-cp35-cp35m-win_amd64.whl", hash = "sha256:8a6c688fefb4e1cd56feb6c511984a6c4f7ec7d2a1ff31a10254f3c817054ae4"}, | ||||||
|  |     {file = "cffi-1.14.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:95cd16d3dee553f882540c1ffe331d085c9e629499ceadfbda4d4fde635f4b7d"}, | ||||||
|  |     {file = "cffi-1.14.0-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:66e41db66b47d0d8672d8ed2708ba91b2f2524ece3dee48b5dfb36be8c2f21dc"}, | ||||||
|  |     {file = "cffi-1.14.0-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:028a579fc9aed3af38f4892bdcc7390508adabc30c6af4a6e4f611b0c680e6ac"}, | ||||||
|  |     {file = "cffi-1.14.0-cp36-cp36m-win32.whl", hash = "sha256:cef128cb4d5e0b3493f058f10ce32365972c554572ff821e175dbc6f8ff6924f"}, | ||||||
|  |     {file = "cffi-1.14.0-cp36-cp36m-win_amd64.whl", hash = "sha256:337d448e5a725bba2d8293c48d9353fc68d0e9e4088d62a9571def317797522b"}, | ||||||
|  |     {file = "cffi-1.14.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:e577934fc5f8779c554639376beeaa5657d54349096ef24abe8c74c5d9c117c3"}, | ||||||
|  |     {file = "cffi-1.14.0-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:62ae9af2d069ea2698bf536dcfe1e4eed9090211dbaafeeedf5cb6c41b352f66"}, | ||||||
|  |     {file = "cffi-1.14.0-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:14491a910663bf9f13ddf2bc8f60562d6bc5315c1f09c704937ef17293fb85b0"}, | ||||||
|  |     {file = "cffi-1.14.0-cp37-cp37m-win32.whl", hash = "sha256:c43866529f2f06fe0edc6246eb4faa34f03fe88b64a0a9a942561c8e22f4b71f"}, | ||||||
|  |     {file = "cffi-1.14.0-cp37-cp37m-win_amd64.whl", hash = "sha256:2089ed025da3919d2e75a4d963d008330c96751127dd6f73c8dc0c65041b4c26"}, | ||||||
|  |     {file = "cffi-1.14.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:3b911c2dbd4f423b4c4fcca138cadde747abdb20d196c4a48708b8a2d32b16dd"}, | ||||||
|  |     {file = "cffi-1.14.0-cp38-cp38-manylinux1_i686.whl", hash = "sha256:7e63cbcf2429a8dbfe48dcc2322d5f2220b77b2e17b7ba023d6166d84655da55"}, | ||||||
|  |     {file = "cffi-1.14.0-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:3d311bcc4a41408cf5854f06ef2c5cab88f9fded37a3b95936c9879c1640d4c2"}, | ||||||
|  |     {file = "cffi-1.14.0-cp38-cp38-win32.whl", hash = "sha256:675686925a9fb403edba0114db74e741d8181683dcf216be697d208857e04ca8"}, | ||||||
|  |     {file = "cffi-1.14.0-cp38-cp38-win_amd64.whl", hash = "sha256:00789914be39dffba161cfc5be31b55775de5ba2235fe49aa28c148236c4e06b"}, | ||||||
|  |     {file = "cffi-1.14.0.tar.gz", hash = "sha256:2d384f4a127a15ba701207f7639d94106693b6cd64173d6c8988e2c25f3ac2b6"}, | ||||||
|  | ] | ||||||
|  | ciso8601 = [ | ||||||
|  |     {file = "ciso8601-2.1.3.tar.gz", hash = "sha256:bdbb5b366058b1c87735603b23060962c439ac9be66f1ae91e8c7dbd7d59e262"}, | ||||||
|  | ] | ||||||
|  | cryptography = [ | ||||||
|  |     {file = "cryptography-2.9.2-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:daf54a4b07d67ad437ff239c8a4080cfd1cc7213df57d33c97de7b4738048d5e"}, | ||||||
|  |     {file = "cryptography-2.9.2-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:3b3eba865ea2754738616f87292b7f29448aec342a7c720956f8083d252bf28b"}, | ||||||
|  |     {file = "cryptography-2.9.2-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:c447cf087cf2dbddc1add6987bbe2f767ed5317adb2d08af940db517dd704365"}, | ||||||
|  |     {file = "cryptography-2.9.2-cp27-cp27m-win32.whl", hash = "sha256:f118a95c7480f5be0df8afeb9a11bd199aa20afab7a96bcf20409b411a3a85f0"}, | ||||||
|  |     {file = "cryptography-2.9.2-cp27-cp27m-win_amd64.whl", hash = "sha256:c4fd17d92e9d55b84707f4fd09992081ba872d1a0c610c109c18e062e06a2e55"}, | ||||||
|  |     {file = "cryptography-2.9.2-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:d0d5aeaedd29be304848f1c5059074a740fa9f6f26b84c5b63e8b29e73dfc270"}, | ||||||
|  |     {file = "cryptography-2.9.2-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:1e4014639d3d73fbc5ceff206049c5a9a849cefd106a49fa7aaaa25cc0ce35cf"}, | ||||||
|  |     {file = "cryptography-2.9.2-cp35-abi3-macosx_10_9_x86_64.whl", hash = "sha256:96c080ae7118c10fcbe6229ab43eb8b090fccd31a09ef55f83f690d1ef619a1d"}, | ||||||
|  |     {file = "cryptography-2.9.2-cp35-abi3-manylinux1_x86_64.whl", hash = "sha256:e993468c859d084d5579e2ebee101de8f5a27ce8e2159959b6673b418fd8c785"}, | ||||||
|  |     {file = "cryptography-2.9.2-cp35-abi3-manylinux2010_x86_64.whl", hash = "sha256:88c881dd5a147e08d1bdcf2315c04972381d026cdb803325c03fe2b4a8ed858b"}, | ||||||
|  |     {file = "cryptography-2.9.2-cp35-cp35m-win32.whl", hash = "sha256:651448cd2e3a6bc2bb76c3663785133c40d5e1a8c1a9c5429e4354201c6024ae"}, | ||||||
|  |     {file = "cryptography-2.9.2-cp35-cp35m-win_amd64.whl", hash = "sha256:726086c17f94747cedbee6efa77e99ae170caebeb1116353c6cf0ab67ea6829b"}, | ||||||
|  |     {file = "cryptography-2.9.2-cp36-cp36m-win32.whl", hash = "sha256:091d31c42f444c6f519485ed528d8b451d1a0c7bf30e8ca583a0cac44b8a0df6"}, | ||||||
|  |     {file = "cryptography-2.9.2-cp36-cp36m-win_amd64.whl", hash = "sha256:bb1f0281887d89617b4c68e8db9a2c42b9efebf2702a3c5bf70599421a8623e3"}, | ||||||
|  |     {file = "cryptography-2.9.2-cp37-cp37m-win32.whl", hash = "sha256:18452582a3c85b96014b45686af264563e3e5d99d226589f057ace56196ec78b"}, | ||||||
|  |     {file = "cryptography-2.9.2-cp37-cp37m-win_amd64.whl", hash = "sha256:22e91636a51170df0ae4dcbd250d318fd28c9f491c4e50b625a49964b24fe46e"}, | ||||||
|  |     {file = "cryptography-2.9.2-cp38-cp38-win32.whl", hash = "sha256:844a76bc04472e5135b909da6aed84360f522ff5dfa47f93e3dd2a0b84a89fa0"}, | ||||||
|  |     {file = "cryptography-2.9.2-cp38-cp38-win_amd64.whl", hash = "sha256:1dfa985f62b137909496e7fc182dac687206d8d089dd03eaeb28ae16eec8e7d5"}, | ||||||
|  |     {file = "cryptography-2.9.2.tar.gz", hash = "sha256:a0c30272fb4ddda5f5ffc1089d7405b7a71b0b0f51993cb4e5dbb4590b2fc229"}, | ||||||
|  | ] | ||||||
|  | iso8601 = [ | ||||||
|  |     {file = "iso8601-0.1.12-py2.py3-none-any.whl", hash = "sha256:210e0134677cc0d02f6028087fee1df1e1d76d372ee1db0bf30bf66c5c1c89a3"}, | ||||||
|  |     {file = "iso8601-0.1.12-py3-none-any.whl", hash = "sha256:bbbae5fb4a7abfe71d4688fd64bff70b91bbd74ef6a99d964bab18f7fdf286dd"}, | ||||||
|  |     {file = "iso8601-0.1.12.tar.gz", hash = "sha256:49c4b20e1f38aa5cf109ddcd39647ac419f928512c869dc01d5c7098eddede82"}, | ||||||
|  | ] | ||||||
|  | pycparser = [ | ||||||
|  |     {file = "pycparser-2.20-py2.py3-none-any.whl", hash = "sha256:7582ad22678f0fcd81102833f60ef8d0e57288b6b5fb00323d101be910e35705"}, | ||||||
|  |     {file = "pycparser-2.20.tar.gz", hash = "sha256:2d475327684562c3a96cc71adf7dc8c4f0565175cf86b6d7a404ff4c771f15f0"}, | ||||||
|  | ] | ||||||
|  | pymysql = [ | ||||||
|  |     {file = "PyMySQL-0.9.2-py2.py3-none-any.whl", hash = "sha256:95f057328357e0e13a30e67857a8c694878b0175797a9a203ee7adbfb9b1ec5f"}, | ||||||
|  |     {file = "PyMySQL-0.9.2.tar.gz", hash = "sha256:9ec760cbb251c158c19d6c88c17ca00a8632bac713890e465b2be01fdc30713f"}, | ||||||
|  | ] | ||||||
|  | pypika = [ | ||||||
|  |     {file = "PyPika-0.37.6.tar.gz", hash = "sha256:64510fa36667e8bb654bdc1be5a3a77bac1dbc2f03d4848efac08e39d9cac6f5"}, | ||||||
|  | ] | ||||||
|  | six = [ | ||||||
|  |     {file = "six-1.14.0-py2.py3-none-any.whl", hash = "sha256:8f3cd2e254d8f793e7f3d6d9df77b92252b52637291d0f0da013c76ea2724b6c"}, | ||||||
|  |     {file = "six-1.14.0.tar.gz", hash = "sha256:236bdbdce46e6e6a3d61a337c0f8b763ca1e8717c03b369e87a7ec7ce1319c0a"}, | ||||||
|  | ] | ||||||
|  | taskipy = [ | ||||||
|  |     {file = "taskipy-1.2.1-py3-none-any.whl", hash = "sha256:99bdaf5b19791c2345806847147e0fc2d28e1ac9446058def5a8b6b3fc9f23e2"}, | ||||||
|  |     {file = "taskipy-1.2.1.tar.gz", hash = "sha256:5eb2c3b1606c896c7fa799848e71e8883b880759224958d07ba760e5db263175"}, | ||||||
|  | ] | ||||||
|  | toml = [ | ||||||
|  |     {file = "toml-0.10.0-py2.7.egg", hash = "sha256:f1db651f9657708513243e61e6cc67d101a39bad662eaa9b5546f789338e07a3"}, | ||||||
|  |     {file = "toml-0.10.0-py2.py3-none-any.whl", hash = "sha256:235682dd292d5899d361a811df37e04a8828a5b1da3115886b73cf81ebc9100e"}, | ||||||
|  |     {file = "toml-0.10.0.tar.gz", hash = "sha256:229f81c57791a41d65e399fc06bf0848bab550a9dfd5ed66df18ce5f05e73d5c"}, | ||||||
|  | ] | ||||||
|  | tortoise-orm = [ | ||||||
|  |     {file = "tortoise-orm-0.16.10.tar.gz", hash = "sha256:b3f4fdc9edabfc88413b7c5297b6cb9408420d1a97d9ad25051170b2b6228e02"}, | ||||||
|  | ] | ||||||
|  | typing-extensions = [ | ||||||
|  |     {file = "typing_extensions-3.7.4.2-py2-none-any.whl", hash = "sha256:f8d2bd89d25bc39dabe7d23df520442fa1d8969b82544370e03d88b5a591c392"}, | ||||||
|  |     {file = "typing_extensions-3.7.4.2-py3-none-any.whl", hash = "sha256:6e95524d8a547a91e08f404ae485bbb71962de46967e1b71a0cb89af24e761c5"}, | ||||||
|  |     {file = "typing_extensions-3.7.4.2.tar.gz", hash = "sha256:79ee589a3caca649a9bfd2a8de4709837400dfa00b6cc81962a1e6a1815969ae"}, | ||||||
|  | ] | ||||||
							
								
								
									
										21
									
								
								pyproject.toml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								pyproject.toml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | |||||||
|  | [tool.poetry] | ||||||
|  | name = "alice" | ||||||
|  | version = "0.1.0" | ||||||
|  | description = "A database migrations tool for Tortoise ORM." | ||||||
|  | authors = ["long2ice <long2ice@gmail.com>"] | ||||||
|  |  | ||||||
|  | [tool.poetry.dependencies] | ||||||
|  | python = "^3.8" | ||||||
|  | tortoise-orm = "*" | ||||||
|  | aiomysql = "*" | ||||||
|  |  | ||||||
|  | [tool.poetry.dev-dependencies] | ||||||
|  | taskipy = "*" | ||||||
|  | asynctest = "*" | ||||||
|  |  | ||||||
|  | [build-system] | ||||||
|  | requires = ["poetry>=0.12"] | ||||||
|  | build-backend = "poetry.masonry.api" | ||||||
|  |  | ||||||
|  | [tool.taskipy.tasks] | ||||||
|  | export = "poetry export -f requirements.txt --without-hashes > requirements.txt" | ||||||
							
								
								
									
										12
									
								
								requirements.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								requirements.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | |||||||
|  | aiomysql==0.0.20 | ||||||
|  | aiosqlite==0.13.0 | ||||||
|  | cffi==1.14.0 | ||||||
|  | ciso8601==2.1.3; sys_platform != "win32" and implementation_name == "cpython" | ||||||
|  | cryptography==2.9.2 | ||||||
|  | iso8601==0.1.12; sys_platform == "win32" or implementation_name != "cpython" | ||||||
|  | pycparser==2.20 | ||||||
|  | pymysql==0.9.2 | ||||||
|  | pypika==0.37.6 | ||||||
|  | six==1.14.0 | ||||||
|  | tortoise-orm==0.16.10 | ||||||
|  | typing-extensions==3.7.4.2 | ||||||
							
								
								
									
										68
									
								
								tests/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								tests/__init__.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,68 @@ | |||||||
|  | import datetime | ||||||
|  | from enum import IntEnum | ||||||
|  | from tortoise import fields, Model | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class ProductType(IntEnum): | ||||||
|  |     article = 1 | ||||||
|  |     page = 2 | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class PermissionAction(IntEnum): | ||||||
|  |     create = 1 | ||||||
|  |     delete = 2 | ||||||
|  |     update = 3 | ||||||
|  |     read = 4 | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class Status(IntEnum): | ||||||
|  |     on = 1 | ||||||
|  |     off = 0 | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class User(Model): | ||||||
|  |     username = fields.CharField(max_length=20, unique=True) | ||||||
|  |     password = fields.CharField(max_length=200) | ||||||
|  |     last_login = fields.DatetimeField(description='Last Login', default=datetime.datetime.now) | ||||||
|  |     is_active = fields.BooleanField(default=True, description='Is Active') | ||||||
|  |     is_superuser = fields.BooleanField(default=False, description='Is SuperUser') | ||||||
|  |     avatar = fields.CharField(max_length=200, default='') | ||||||
|  |     intro = fields.TextField(default='') | ||||||
|  |     created_at = fields.DatetimeField(auto_now_add=True) | ||||||
|  |  | ||||||
|  |     def __str__(self): | ||||||
|  |         return f'{self.pk}#{self.username}' | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class Category(Model): | ||||||
|  |     slug = fields.CharField(max_length=200) | ||||||
|  |     name = fields.CharField(max_length=200) | ||||||
|  |     created_at = fields.DatetimeField(auto_now_add=True) | ||||||
|  |  | ||||||
|  |     def __str__(self): | ||||||
|  |         return f'{self.pk}#{self.name}' | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class Product(Model): | ||||||
|  |     categories = fields.ManyToManyField('models.Category') | ||||||
|  |     name = fields.CharField(max_length=50) | ||||||
|  |     view_num = fields.IntField(description='View Num') | ||||||
|  |     sort = fields.IntField() | ||||||
|  |     is_reviewed = fields.BooleanField(description='Is Reviewed') | ||||||
|  |     type = fields.IntEnumField(ProductType, description='Product Type') | ||||||
|  |     image = fields.CharField(max_length=200) | ||||||
|  |     body = fields.TextField() | ||||||
|  |     created_at = fields.DatetimeField(auto_now_add=True) | ||||||
|  |  | ||||||
|  |     def __str__(self): | ||||||
|  |         return f'{self.pk}#{self.name}' | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class Config(Model): | ||||||
|  |     label = fields.CharField(max_length=200) | ||||||
|  |     key = fields.CharField(max_length=20) | ||||||
|  |     value = fields.JSONField() | ||||||
|  |     status: Status = fields.IntEnumField(Status, default=Status.on) | ||||||
|  |  | ||||||
|  |     def __str__(self): | ||||||
|  |         return f'{self.pk}#{self.label}' | ||||||
							
								
								
									
										29
									
								
								tests/test_backends.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								tests/test_backends.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | |||||||
|  | from asynctest import TestCase | ||||||
|  | from tortoise import Tortoise | ||||||
|  |  | ||||||
|  | from alice.backends.mysql import MysqlDDL | ||||||
|  | from tests import User | ||||||
|  |  | ||||||
|  | TORTOISE_ORM = { | ||||||
|  |     'connections': { | ||||||
|  |         'default': 'mysql://root:123456@127.0.0.1:3306/fastapi-admin' | ||||||
|  |     }, | ||||||
|  |     'apps': { | ||||||
|  |         'models': { | ||||||
|  |             'models': ['tests'], | ||||||
|  |             'default_connection': 'default', | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class TestMysql(TestCase): | ||||||
|  |     async def setUp(self) -> None: | ||||||
|  |         await Tortoise.init(config=TORTOISE_ORM) | ||||||
|  |  | ||||||
|  |     async def test_create_table(self): | ||||||
|  |         ddl = MysqlDDL(Tortoise.get_connection('default'), User) | ||||||
|  |         print(ddl.create_table()) | ||||||
|  |  | ||||||
|  |     async def tearDown(self) -> None: | ||||||
|  |         await Tortoise.close_connections() | ||||||
		Reference in New Issue
	
	Block a user