Use .sql
instead of .json
to store version file. (#79)
This commit is contained in:
parent
f5588a35c5
commit
b21b954d32
@ -1,5 +1,11 @@
|
|||||||
# ChangeLog
|
# ChangeLog
|
||||||
|
|
||||||
|
## 0.4
|
||||||
|
|
||||||
|
### 0.4.0
|
||||||
|
|
||||||
|
- Use `.sql` instead of `.json` to store version file.
|
||||||
|
|
||||||
## 0.3
|
## 0.3
|
||||||
|
|
||||||
### 0.3.3
|
### 0.3.3
|
||||||
|
12
README.md
12
README.md
@ -103,11 +103,11 @@ If your Tortoise-ORM app is not default `models`, you must specify
|
|||||||
```shell
|
```shell
|
||||||
> aerich migrate --name drop_column
|
> aerich migrate --name drop_column
|
||||||
|
|
||||||
Success migrate 1_202029051520102929_drop_column.json
|
Success migrate 1_202029051520102929_drop_column.sql
|
||||||
```
|
```
|
||||||
|
|
||||||
Format of migrate filename is
|
Format of migrate filename is
|
||||||
`{version_num}_{datetime}_{name|update}.json`.
|
`{version_num}_{datetime}_{name|update}.sql`.
|
||||||
|
|
||||||
And if `aerich` guess you are renaming a column, it will ask `Rename {old_column} to {new_column} [True]`, you can choice `True` to rename column without column drop, or choice `False` to drop column then create.
|
And if `aerich` guess you are renaming a column, it will ask `Rename {old_column} to {new_column} [True]`, you can choice `True` to rename column without column drop, or choice `False` to drop column then create.
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ If you use `MySQL`, only MySQL8.0+ support `rename..to` syntax.
|
|||||||
```shell
|
```shell
|
||||||
> aerich upgrade
|
> aerich upgrade
|
||||||
|
|
||||||
Success upgrade 1_202029051520102929_drop_column.json
|
Success upgrade 1_202029051520102929_drop_column.sql
|
||||||
```
|
```
|
||||||
|
|
||||||
Now your db is migrated to latest.
|
Now your db is migrated to latest.
|
||||||
@ -140,7 +140,7 @@ Options:
|
|||||||
```shell
|
```shell
|
||||||
> aerich downgrade
|
> aerich downgrade
|
||||||
|
|
||||||
Success downgrade 1_202029051520102929_drop_column.json
|
Success downgrade 1_202029051520102929_drop_column.sql
|
||||||
```
|
```
|
||||||
|
|
||||||
Now your db rollback to specified version.
|
Now your db rollback to specified version.
|
||||||
@ -150,7 +150,7 @@ Now your db rollback to specified version.
|
|||||||
```shell
|
```shell
|
||||||
> aerich history
|
> aerich history
|
||||||
|
|
||||||
1_202029051520102929_drop_column.json
|
1_202029051520102929_drop_column.sql
|
||||||
```
|
```
|
||||||
|
|
||||||
### Show heads to be migrated
|
### Show heads to be migrated
|
||||||
@ -158,7 +158,7 @@ Now your db rollback to specified version.
|
|||||||
```shell
|
```shell
|
||||||
> aerich heads
|
> aerich heads
|
||||||
|
|
||||||
1_202029051520102929_drop_column.json
|
1_202029051520102929_drop_column.sql
|
||||||
```
|
```
|
||||||
|
|
||||||
### Multiple databases
|
### Multiple databases
|
||||||
|
@ -1 +1 @@
|
|||||||
__version__ = "0.3.3"
|
__version__ = "0.4.0"
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import json
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
@ -13,7 +12,13 @@ from tortoise.transactions import in_transaction
|
|||||||
from tortoise.utils import get_schema_sql
|
from tortoise.utils import get_schema_sql
|
||||||
|
|
||||||
from aerich.migrate import Migrate
|
from aerich.migrate import Migrate
|
||||||
from aerich.utils import get_app_connection, get_app_connection_name, get_tortoise_config
|
from aerich.utils import (
|
||||||
|
get_app_connection,
|
||||||
|
get_app_connection_name,
|
||||||
|
get_tortoise_config,
|
||||||
|
get_version_content_from_file,
|
||||||
|
write_version_file,
|
||||||
|
)
|
||||||
|
|
||||||
from . import __version__
|
from . import __version__
|
||||||
from .enums import Color
|
from .enums import Color
|
||||||
@ -105,9 +110,9 @@ async def upgrade(ctx: Context):
|
|||||||
if not exists:
|
if not exists:
|
||||||
async with in_transaction(get_app_connection_name(config, app)) as conn:
|
async with in_transaction(get_app_connection_name(config, app)) as conn:
|
||||||
file_path = os.path.join(Migrate.migrate_location, version_file)
|
file_path = os.path.join(Migrate.migrate_location, version_file)
|
||||||
with open(file_path, "r", encoding="utf-8") as f:
|
content = get_version_content_from_file(file_path)
|
||||||
content = json.load(f)
|
|
||||||
upgrade_query_list = content.get("upgrade")
|
upgrade_query_list = content.get("upgrade")
|
||||||
|
print(upgrade_query_list)
|
||||||
for upgrade_query in upgrade_query_list:
|
for upgrade_query in upgrade_query_list:
|
||||||
await conn.execute_script(upgrade_query)
|
await conn.execute_script(upgrade_query)
|
||||||
await Aerich.create(
|
await Aerich.create(
|
||||||
@ -152,11 +157,10 @@ async def downgrade(ctx: Context, version: int):
|
|||||||
file = version.version
|
file = version.version
|
||||||
async with in_transaction(get_app_connection_name(config, app)) as conn:
|
async with in_transaction(get_app_connection_name(config, app)) as conn:
|
||||||
file_path = os.path.join(Migrate.migrate_location, file)
|
file_path = os.path.join(Migrate.migrate_location, file)
|
||||||
with open(file_path, "r", encoding="utf-8") as f:
|
content = get_version_content_from_file(file_path)
|
||||||
content = json.load(f)
|
|
||||||
downgrade_query_list = content.get("downgrade")
|
downgrade_query_list = content.get("downgrade")
|
||||||
if not downgrade_query_list:
|
if not downgrade_query_list:
|
||||||
return click.secho("No downgrade item found", fg=Color.yellow)
|
return click.secho("No downgrade items found", fg=Color.yellow)
|
||||||
for downgrade_query in downgrade_query_list:
|
for downgrade_query in downgrade_query_list:
|
||||||
await conn.execute_query(downgrade_query)
|
await conn.execute_query(downgrade_query)
|
||||||
await version.delete()
|
await version.delete()
|
||||||
@ -263,11 +267,10 @@ async def init_db(ctx: Context, safe):
|
|||||||
app=app,
|
app=app,
|
||||||
content=Migrate.get_models_content(config, app, location),
|
content=Migrate.get_models_content(config, app, location),
|
||||||
)
|
)
|
||||||
with open(os.path.join(dirname, version), "w", encoding="utf-8") as f:
|
|
||||||
content = {
|
content = {
|
||||||
"upgrade": [schema],
|
"upgrade": [schema],
|
||||||
}
|
}
|
||||||
json.dump(content, f, ensure_ascii=False, indent=2)
|
write_version_file(os.path.join(dirname, version), content)
|
||||||
return click.secho(f'Success generate schema for app "{app}"', fg=Color.green)
|
return click.secho(f'Success generate schema for app "{app}"', fg=Color.green)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import inspect
|
import inspect
|
||||||
import json
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
@ -21,7 +20,7 @@ from tortoise.fields import Field
|
|||||||
|
|
||||||
from aerich.ddl import BaseDDL
|
from aerich.ddl import BaseDDL
|
||||||
from aerich.models import MAX_VERSION_LENGTH, Aerich
|
from aerich.models import MAX_VERSION_LENGTH, Aerich
|
||||||
from aerich.utils import get_app_connection
|
from aerich.utils import get_app_connection, write_version_file
|
||||||
|
|
||||||
|
|
||||||
class Migrate:
|
class Migrate:
|
||||||
@ -50,7 +49,7 @@ class Migrate:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def get_all_version_files(cls) -> List[str]:
|
def get_all_version_files(cls) -> List[str]:
|
||||||
return sorted(
|
return sorted(
|
||||||
filter(lambda x: x.endswith("json"), os.listdir(cls.migrate_location)),
|
filter(lambda x: x.endswith("sql"), os.listdir(cls.migrate_location)),
|
||||||
key=lambda x: int(x.split("_")[0]),
|
key=lambda x: int(x.split("_")[0]),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -111,8 +110,8 @@ class Migrate:
|
|||||||
now = datetime.now().strftime("%Y%m%d%H%M%S").replace("/", "")
|
now = datetime.now().strftime("%Y%m%d%H%M%S").replace("/", "")
|
||||||
last_version_num = await cls._get_last_version_num()
|
last_version_num = await cls._get_last_version_num()
|
||||||
if last_version_num is None:
|
if last_version_num is None:
|
||||||
return f"0_{now}_init.json"
|
return f"0_{now}_init.sql"
|
||||||
version = f"{last_version_num + 1}_{now}_{name}.json"
|
version = f"{last_version_num + 1}_{now}_{name}.sql"
|
||||||
if len(version) > MAX_VERSION_LENGTH:
|
if len(version) > MAX_VERSION_LENGTH:
|
||||||
raise ValueError(f"Version name exceeds maximum length ({MAX_VERSION_LENGTH})")
|
raise ValueError(f"Version name exceeds maximum length ({MAX_VERSION_LENGTH})")
|
||||||
return version
|
return version
|
||||||
@ -128,8 +127,7 @@ class Migrate:
|
|||||||
"upgrade": cls.upgrade_operators,
|
"upgrade": cls.upgrade_operators,
|
||||||
"downgrade": cls.downgrade_operators,
|
"downgrade": cls.downgrade_operators,
|
||||||
}
|
}
|
||||||
with open(os.path.join(cls.migrate_location, version), "w", encoding="utf-8") as f:
|
write_version_file(os.path.join(cls.migrate_location, version), content)
|
||||||
json.dump(content, f, indent=2, ensure_ascii=False)
|
|
||||||
return version
|
return version
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import importlib
|
import importlib
|
||||||
|
from typing import Dict
|
||||||
|
|
||||||
from click import BadOptionUsage, Context
|
from click import BadOptionUsage, Context
|
||||||
from tortoise import BaseDBAsyncClient, Tortoise
|
from tortoise import BaseDBAsyncClient, Tortoise
|
||||||
@ -49,3 +50,46 @@ def get_tortoise_config(ctx: Context, tortoise_orm: str) -> dict:
|
|||||||
ctx=ctx,
|
ctx=ctx,
|
||||||
)
|
)
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
|
_UPGRADE = "##### upgrade #####\n"
|
||||||
|
_DOWNGRADE = "##### downgrade #####\n"
|
||||||
|
|
||||||
|
|
||||||
|
def get_version_content_from_file(version_file: str) -> Dict:
|
||||||
|
"""
|
||||||
|
get version content
|
||||||
|
:param version_file:
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
with open(version_file, "r", encoding="utf-8") as f:
|
||||||
|
content = f.read()
|
||||||
|
first = content.index(_UPGRADE)
|
||||||
|
second = content.index(_DOWNGRADE)
|
||||||
|
upgrade_content = content[first + len(_UPGRADE) : second].strip() # noqa:E203
|
||||||
|
downgrade_content = content[second + len(_DOWNGRADE) :].strip() # noqa:E203
|
||||||
|
ret = {"upgrade": upgrade_content.split("\n"), "downgrade": downgrade_content.split("\n")}
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
def write_version_file(version_file: str, content: Dict):
|
||||||
|
"""
|
||||||
|
write version file
|
||||||
|
:param version_file:
|
||||||
|
:param content:
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
with open(version_file, "w", encoding="utf-8") as f:
|
||||||
|
f.write(_UPGRADE)
|
||||||
|
upgrade = content.get("upgrade")
|
||||||
|
if len(upgrade) > 1:
|
||||||
|
f.write(";\n".join(upgrade) + ";\n")
|
||||||
|
else:
|
||||||
|
f.write(f"{upgrade[0]};\n")
|
||||||
|
downgrade = content.get("downgrade")
|
||||||
|
if downgrade:
|
||||||
|
f.write(_DOWNGRADE)
|
||||||
|
if len(downgrade) > 1:
|
||||||
|
f.write(";\n".join(downgrade) + ";\n")
|
||||||
|
else:
|
||||||
|
f.write(f"{downgrade[0]};\n")
|
||||||
|
117
poetry.lock
generated
117
poetry.lock
generated
@ -461,6 +461,14 @@ pytest-forked = "*"
|
|||||||
psutil = ["psutil (>=3.0)"]
|
psutil = ["psutil (>=3.0)"]
|
||||||
testing = ["filelock"]
|
testing = ["filelock"]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pytz"
|
||||||
|
version = "2020.4"
|
||||||
|
description = "World timezone definitions, modern and historical"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = "*"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pyyaml"
|
name = "pyyaml"
|
||||||
version = "5.3.1"
|
version = "5.3.1"
|
||||||
@ -471,7 +479,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex"
|
name = "regex"
|
||||||
version = "2020.11.11"
|
version = "2020.11.13"
|
||||||
description = "Alternative regular expression module, to replace re."
|
description = "Alternative regular expression module, to replace re."
|
||||||
category = "dev"
|
category = "dev"
|
||||||
optional = false
|
optional = false
|
||||||
@ -515,21 +523,23 @@ python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tortoise-orm"
|
name = "tortoise-orm"
|
||||||
version = "0.16.17"
|
version = "0.16.18"
|
||||||
description = "Easy async ORM for python, built with relations in mind"
|
description = "Easy async ORM for python, built with relations in mind"
|
||||||
category = "main"
|
category = "main"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = "*"
|
python-versions = ">=3.7,<4.0"
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
aerich = ">=0.3.2"
|
aiosqlite = ">=0.16.0,<0.17.0"
|
||||||
aiosqlite = ">=0.11.0"
|
iso8601 = ">=0.1.13,<0.2.0"
|
||||||
iso8601 = ">=0.1.12"
|
pypika = ">=0.44.0,<0.45.0"
|
||||||
pypika = ">=0.39.0"
|
pytz = ">=2020.4,<2021.0"
|
||||||
typing-extensions = ">=3.7"
|
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
accel = ["python-rapidjson", "ciso8601 (>=2.1.2)", "uvloop (>=0.12.0)"]
|
docs = ["pygments", "cloud-sptheme", "docutils", "sphinx"]
|
||||||
|
aiomysql = ["aiomysql"]
|
||||||
|
asyncpg = ["asyncpg"]
|
||||||
|
accel = ["ciso8601 (>=2.1.2,<3.0.0)", "python-rapidjson", "uvloop (>=0.12.0,<0.13.0)"]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typed-ast"
|
name = "typed-ast"
|
||||||
@ -824,6 +834,10 @@ pytest-xdist = [
|
|||||||
{file = "pytest-xdist-2.1.0.tar.gz", hash = "sha256:82d938f1a24186520e2d9d3a64ef7d9ac7ecdf1a0659e095d18e596b8cbd0672"},
|
{file = "pytest-xdist-2.1.0.tar.gz", hash = "sha256:82d938f1a24186520e2d9d3a64ef7d9ac7ecdf1a0659e095d18e596b8cbd0672"},
|
||||||
{file = "pytest_xdist-2.1.0-py3-none-any.whl", hash = "sha256:7c629016b3bb006b88ac68e2b31551e7becf173c76b977768848e2bbed594d90"},
|
{file = "pytest_xdist-2.1.0-py3-none-any.whl", hash = "sha256:7c629016b3bb006b88ac68e2b31551e7becf173c76b977768848e2bbed594d90"},
|
||||||
]
|
]
|
||||||
|
pytz = [
|
||||||
|
{file = "pytz-2020.4-py2.py3-none-any.whl", hash = "sha256:5c55e189b682d420be27c6995ba6edce0c0a77dd67bfbe2ae6607134d5851ffd"},
|
||||||
|
{file = "pytz-2020.4.tar.gz", hash = "sha256:3e6b7dd2d1e0a59084bcee14a17af60c5c562cdc16d828e8eba2e683d3a7e268"},
|
||||||
|
]
|
||||||
pyyaml = [
|
pyyaml = [
|
||||||
{file = "PyYAML-5.3.1-cp27-cp27m-win32.whl", hash = "sha256:74809a57b329d6cc0fdccee6318f44b9b8649961fa73144a98735b0aaf029f1f"},
|
{file = "PyYAML-5.3.1-cp27-cp27m-win32.whl", hash = "sha256:74809a57b329d6cc0fdccee6318f44b9b8649961fa73144a98735b0aaf029f1f"},
|
||||||
{file = "PyYAML-5.3.1-cp27-cp27m-win_amd64.whl", hash = "sha256:240097ff019d7c70a4922b6869d8a86407758333f02203e0fc6ff79c5dcede76"},
|
{file = "PyYAML-5.3.1-cp27-cp27m-win_amd64.whl", hash = "sha256:240097ff019d7c70a4922b6869d8a86407758333f02203e0fc6ff79c5dcede76"},
|
||||||
@ -838,47 +852,47 @@ pyyaml = [
|
|||||||
{file = "PyYAML-5.3.1.tar.gz", hash = "sha256:b8eac752c5e14d3eca0e6dd9199cd627518cb5ec06add0de9d32baeee6fe645d"},
|
{file = "PyYAML-5.3.1.tar.gz", hash = "sha256:b8eac752c5e14d3eca0e6dd9199cd627518cb5ec06add0de9d32baeee6fe645d"},
|
||||||
]
|
]
|
||||||
regex = [
|
regex = [
|
||||||
{file = "regex-2020.11.11-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:dd7bee615680d940dd44ac0a479f2bc5f73d6ca63a5915cd8d30739c14ca522c"},
|
{file = "regex-2020.11.13-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:8b882a78c320478b12ff024e81dc7d43c1462aa4a3341c754ee65d857a521f85"},
|
||||||
{file = "regex-2020.11.11-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:3002ee2d4e8bbe4656237627203d8290a562d1fc1962deee470905ab63570345"},
|
{file = "regex-2020.11.13-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:a63f1a07932c9686d2d416fb295ec2c01ab246e89b4d58e5fa468089cab44b70"},
|
||||||
{file = "regex-2020.11.11-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:064d2fc83ab4ee0055fcc1ef38ec60e505742850a40061f854ac64cb3d8d6dd3"},
|
{file = "regex-2020.11.13-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:6e4b08c6f8daca7d8f07c8d24e4331ae7953333dbd09c648ed6ebd24db5a10ee"},
|
||||||
{file = "regex-2020.11.11-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:83a390a653c13be1ab26287240df1fd9324ca8a0d31b603fa57cd7d9520648fa"},
|
{file = "regex-2020.11.13-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:bba349276b126947b014e50ab3316c027cac1495992f10e5682dc677b3dfa0c5"},
|
||||||
{file = "regex-2020.11.11-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:412969d58ecd4f576510ec88bcb7602e9e582bbef78859ed8c9ca4de4f9e891c"},
|
{file = "regex-2020.11.13-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:56e01daca75eae420bce184edd8bb341c8eebb19dd3bce7266332258f9fb9dd7"},
|
||||||
{file = "regex-2020.11.11-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:ccfea4911ac28a8f744096bce1559e0bd86b09a53c8a9d5856ca8e1f5f4de1f5"},
|
{file = "regex-2020.11.13-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:6a8ce43923c518c24a2579fda49f093f1397dad5d18346211e46f134fc624e31"},
|
||||||
{file = "regex-2020.11.11-cp36-cp36m-manylinux2014_i686.whl", hash = "sha256:cefcdb2ac3b67fd9f7244820ce1965c8cf352366199cc1358d67c6cc3c5c8bbc"},
|
{file = "regex-2020.11.13-cp36-cp36m-manylinux2014_i686.whl", hash = "sha256:1ab79fcb02b930de09c76d024d279686ec5d532eb814fd0ed1e0051eb8bd2daa"},
|
||||||
{file = "regex-2020.11.11-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:9e8b3187f6beea8e56cb4b33c35049cbe376cf69aefaee5bc035309d88c98ca5"},
|
{file = "regex-2020.11.13-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:9801c4c1d9ae6a70aeb2128e5b4b68c45d4f0af0d1535500884d644fa9b768c6"},
|
||||||
{file = "regex-2020.11.11-cp36-cp36m-win32.whl", hash = "sha256:787e44e5f4fd027dd90b5ee0240b05dc1752cb43c2903617f25baa495fe551e9"},
|
{file = "regex-2020.11.13-cp36-cp36m-win32.whl", hash = "sha256:49cae022fa13f09be91b2c880e58e14b6da5d10639ed45ca69b85faf039f7a4e"},
|
||||||
{file = "regex-2020.11.11-cp36-cp36m-win_amd64.whl", hash = "sha256:a9f76d9122359b09e38f27cd9c41729169171cf0fd73ec5b22cc4628f9e486ca"},
|
{file = "regex-2020.11.13-cp36-cp36m-win_amd64.whl", hash = "sha256:749078d1eb89484db5f34b4012092ad14b327944ee7f1c4f74d6279a6e4d1884"},
|
||||||
{file = "regex-2020.11.11-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:6d128368def4b0cd95c0fc9d99a89ae73c083b25e67f27a410830e30f9df0edc"},
|
{file = "regex-2020.11.13-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b2f4007bff007c96a173e24dcda236e5e83bde4358a557f9ccf5e014439eae4b"},
|
||||||
{file = "regex-2020.11.11-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:df50ba964812606663ca9d23d374036bc5ae3d71e86168409cdd84ca7948d8a3"},
|
{file = "regex-2020.11.13-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:38c8fd190db64f513fe4e1baa59fed086ae71fa45083b6936b52d34df8f86a88"},
|
||||||
{file = "regex-2020.11.11-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:d1e57c16c4840f1c3543507742e99b8398609474a0e6a6925476914479de3488"},
|
{file = "regex-2020.11.13-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:5862975b45d451b6db51c2e654990c1820523a5b07100fc6903e9c86575202a0"},
|
||||||
{file = "regex-2020.11.11-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:6e50b3b417ab2fd67bfa6235f0df4782fe2ff8be83f0c4435e1dc43d25052ee8"},
|
{file = "regex-2020.11.13-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:262c6825b309e6485ec2493ffc7e62a13cf13fb2a8b6d212f72bd53ad34118f1"},
|
||||||
{file = "regex-2020.11.11-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:bb17a7fe9c47167337009ce18cd6e6b3edf3ca0063bf6bed6ce02515129c016a"},
|
{file = "regex-2020.11.13-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:bafb01b4688833e099d79e7efd23f99172f501a15c44f21ea2118681473fdba0"},
|
||||||
{file = "regex-2020.11.11-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:826d0119f14f9a9ce25999a13ed5922c785b50e469800f6e5a6721318650ef49"},
|
{file = "regex-2020.11.13-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:e32f5f3d1b1c663af7f9c4c1e72e6ffe9a78c03a31e149259f531e0fed826512"},
|
||||||
{file = "regex-2020.11.11-cp37-cp37m-manylinux2014_i686.whl", hash = "sha256:8cc3717146ce4040419639cf45455663a002a554806ddac46304acc5bd41dae2"},
|
{file = "regex-2020.11.13-cp37-cp37m-manylinux2014_i686.whl", hash = "sha256:3bddc701bdd1efa0d5264d2649588cbfda549b2899dc8d50417e47a82e1387ba"},
|
||||||
{file = "regex-2020.11.11-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:86ad88c7c2512094a85b0a01ce053bab1e28eafb8f3868bb8c22f4903e33f147"},
|
{file = "regex-2020.11.13-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:02951b7dacb123d8ea6da44fe45ddd084aa6777d4b2454fa0da61d569c6fa538"},
|
||||||
{file = "regex-2020.11.11-cp37-cp37m-win32.whl", hash = "sha256:e03867f3baf64ecab47dfc9ddb58afc67acb6a0f80f6cf8ff9fa82962ec4d1cd"},
|
{file = "regex-2020.11.13-cp37-cp37m-win32.whl", hash = "sha256:0d08e71e70c0237883d0bef12cad5145b84c3705e9c6a588b2a9c7080e5af2a4"},
|
||||||
{file = "regex-2020.11.11-cp37-cp37m-win_amd64.whl", hash = "sha256:56d1e298bb6482d0466399a6383181bf2627c37ad414e205b3ce0f85aa140be7"},
|
{file = "regex-2020.11.13-cp37-cp37m-win_amd64.whl", hash = "sha256:1fa7ee9c2a0e30405e21031d07d7ba8617bc590d391adfc2b7f1e8b99f46f444"},
|
||||||
{file = "regex-2020.11.11-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:19ac2bf0048a2f4d460ee20647e84ca160512a7ee8af844dc9207720778470f1"},
|
{file = "regex-2020.11.13-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:baf378ba6151f6e272824b86a774326f692bc2ef4cc5ce8d5bc76e38c813a55f"},
|
||||||
{file = "regex-2020.11.11-cp38-cp38-manylinux1_i686.whl", hash = "sha256:84ab584dcb5e81815040d86148805a808acb0bee303d19638fe2f9488d704bc1"},
|
{file = "regex-2020.11.13-cp38-cp38-manylinux1_i686.whl", hash = "sha256:e3faaf10a0d1e8e23a9b51d1900b72e1635c2d5b0e1bea1c18022486a8e2e52d"},
|
||||||
{file = "regex-2020.11.11-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:4159ecf20dffea07f4a7241b2a236f90eb622c7e8caab9f43caba5f27ca37284"},
|
{file = "regex-2020.11.13-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:2a11a3e90bd9901d70a5b31d7dd85114755a581a5da3fc996abfefa48aee78af"},
|
||||||
{file = "regex-2020.11.11-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:8060be04baec546fe3afa6975d2998e15d1b655d7255f0e6b0ed3f482cccc218"},
|
{file = "regex-2020.11.13-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:d1ebb090a426db66dd80df8ca85adc4abfcbad8a7c2e9a5ec7513ede522e0a8f"},
|
||||||
{file = "regex-2020.11.11-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:cdb98be55db1b94c950822cbc10d3d768f01e184365851ebb42cd377486ced7b"},
|
{file = "regex-2020.11.13-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:b2b1a5ddae3677d89b686e5c625fc5547c6e492bd755b520de5332773a8af06b"},
|
||||||
{file = "regex-2020.11.11-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:11d9100bd874ce8b2a037db9150e732cd768359fc25fe5f77973208aa24eb13e"},
|
{file = "regex-2020.11.13-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:2c99e97d388cd0a8d30f7c514d67887d8021541b875baf09791a3baad48bb4f8"},
|
||||||
{file = "regex-2020.11.11-cp38-cp38-manylinux2014_i686.whl", hash = "sha256:0951c78fa4cb26d1278a4b3784fcf973fc97ec39c07483328a74b034b0cc569c"},
|
{file = "regex-2020.11.13-cp38-cp38-manylinux2014_i686.whl", hash = "sha256:c084582d4215593f2f1d28b65d2a2f3aceff8342aa85afd7be23a9cad74a0de5"},
|
||||||
{file = "regex-2020.11.11-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:c8b1ad791debd67221fb1266f8d09730ae927acacb32d0dad9fd07a7d341a28f"},
|
{file = "regex-2020.11.13-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:a3d748383762e56337c39ab35c6ed4deb88df5326f97a38946ddd19028ecce6b"},
|
||||||
{file = "regex-2020.11.11-cp38-cp38-win32.whl", hash = "sha256:beae9db1545f8116cfc9301a9601e9c975bb56ca22a38ac0fe06a72c3460f31a"},
|
{file = "regex-2020.11.13-cp38-cp38-win32.whl", hash = "sha256:7913bd25f4ab274ba37bc97ad0e21c31004224ccb02765ad984eef43e04acc6c"},
|
||||||
{file = "regex-2020.11.11-cp38-cp38-win_amd64.whl", hash = "sha256:48e94218f06317b6d32feb4ecff8b6025695450009bcb3291fb23daf79689431"},
|
{file = "regex-2020.11.13-cp38-cp38-win_amd64.whl", hash = "sha256:6c54ce4b5d61a7129bad5c5dc279e222afd00e721bf92f9ef09e4fae28755683"},
|
||||||
{file = "regex-2020.11.11-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c67fd5f3ad81f8301184354014e8e7510ab77e0c7e450a427d77f28ae8effbef"},
|
{file = "regex-2020.11.13-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:1862a9d9194fae76a7aaf0150d5f2a8ec1da89e8b55890b1786b8f88a0f619dc"},
|
||||||
{file = "regex-2020.11.11-cp39-cp39-manylinux1_i686.whl", hash = "sha256:e7cdd5ee8053c82607432b7ebad37e2ece54548fef2b254f7bce6f7831904586"},
|
{file = "regex-2020.11.13-cp39-cp39-manylinux1_i686.whl", hash = "sha256:4902e6aa086cbb224241adbc2f06235927d5cdacffb2425c73e6570e8d862364"},
|
||||||
{file = "regex-2020.11.11-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:394b5be4fa72354a78763b317f82997ad881896dd4a860e429a6fa74afaacb07"},
|
{file = "regex-2020.11.13-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:7a25fcbeae08f96a754b45bdc050e1fb94b95cab046bf56b016c25e9ab127b3e"},
|
||||||
{file = "regex-2020.11.11-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:3b46a4c73ec1f25361147a7a0fd86084f3627dc78d09bcbe14e70db12683efec"},
|
{file = "regex-2020.11.13-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:d2d8ce12b7c12c87e41123997ebaf1a5767a5be3ec545f64675388970f415e2e"},
|
||||||
{file = "regex-2020.11.11-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:267d1b13f863e664150948ce2a9ed4927bf4ac7a068780f1ee8af83352aa17a2"},
|
{file = "regex-2020.11.13-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:f7d29a6fc4760300f86ae329e3b6ca28ea9c20823df123a2ea8693e967b29917"},
|
||||||
{file = "regex-2020.11.11-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:68267a7a5fb0bd9676b86f967143b6a6ecefb3eed4042ecc9e7f0e014aef8f74"},
|
{file = "regex-2020.11.13-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:717881211f46de3ab130b58ec0908267961fadc06e44f974466d1887f865bd5b"},
|
||||||
{file = "regex-2020.11.11-cp39-cp39-manylinux2014_i686.whl", hash = "sha256:e899b69dd5d26655cb454835ea2fceb18832c9ee9c4fb45dc4cf8a6089d35312"},
|
{file = "regex-2020.11.13-cp39-cp39-manylinux2014_i686.whl", hash = "sha256:3128e30d83f2e70b0bed9b2a34e92707d0877e460b402faca908c6667092ada9"},
|
||||||
{file = "regex-2020.11.11-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:396411bb5a7849aeda9c49873b8295919fdc118c50b57122b09cb2097047c118"},
|
{file = "regex-2020.11.13-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:8f6a2229e8ad946e36815f2a03386bb8353d4bde368fdf8ca5f0cb97264d3b5c"},
|
||||||
{file = "regex-2020.11.11-cp39-cp39-win32.whl", hash = "sha256:32f8714c4bcc4b0d2aa259b1647e3c5b6cfe2e923c6c124234a5e03408224227"},
|
{file = "regex-2020.11.13-cp39-cp39-win32.whl", hash = "sha256:f8f295db00ef5f8bae530fc39af0b40486ca6068733fb860b42115052206466f"},
|
||||||
{file = "regex-2020.11.11-cp39-cp39-win_amd64.whl", hash = "sha256:bf02ab95ff5261ba108725dbd795bf6395eaac1b8468b41472d82d35b12b0295"},
|
{file = "regex-2020.11.13-cp39-cp39-win_amd64.whl", hash = "sha256:a15f64ae3a027b64496a71ab1f722355e570c3fac5ba2801cafce846bf5af01d"},
|
||||||
{file = "regex-2020.11.11.tar.gz", hash = "sha256:0a235841237d4487329bcabcb5b902858f7967f5e684e08e968367f25b2c3d37"},
|
{file = "regex-2020.11.13.tar.gz", hash = "sha256:83d6b356e116ca119db8e7c6fc2983289d87b27b3fac238cfe5dca529d884562"},
|
||||||
]
|
]
|
||||||
six = [
|
six = [
|
||||||
{file = "six-1.15.0-py2.py3-none-any.whl", hash = "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"},
|
{file = "six-1.15.0-py2.py3-none-any.whl", hash = "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"},
|
||||||
@ -897,7 +911,8 @@ toml = [
|
|||||||
{file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"},
|
{file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"},
|
||||||
]
|
]
|
||||||
tortoise-orm = [
|
tortoise-orm = [
|
||||||
{file = "tortoise-orm-0.16.17.tar.gz", hash = "sha256:bcb978d302ba1d71ee2089352ca07b3ed73fd55936b5d580e29ffed5a0784c03"},
|
{file = "tortoise-orm-0.16.18.tar.gz", hash = "sha256:0ef2a469be28f1d29729e666daa40de40fa0123dace3e40de8cded52e9013e2a"},
|
||||||
|
{file = "tortoise_orm-0.16.18-py3-none-any.whl", hash = "sha256:980935889dc275910eb53ea38f2895cec5e727068bf701870da5b13060fa13ad"},
|
||||||
]
|
]
|
||||||
typed-ast = [
|
typed-ast = [
|
||||||
{file = "typed_ast-1.4.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:73d785a950fc82dd2a25897d525d003f6378d1cb23ab305578394694202a58c3"},
|
{file = "typed_ast-1.4.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:73d785a950fc82dd2a25897d525d003f6378d1cb23ab305578394694202a58c3"},
|
||||||
|
@ -62,18 +62,18 @@ def test_sort_all_version_files(mocker):
|
|||||||
mocker.patch(
|
mocker.patch(
|
||||||
"os.listdir",
|
"os.listdir",
|
||||||
return_value=[
|
return_value=[
|
||||||
"1_datetime_update.json",
|
"1_datetime_update.sql",
|
||||||
"11_datetime_update.json",
|
"11_datetime_update.sql",
|
||||||
"10_datetime_update.json",
|
"10_datetime_update.sql",
|
||||||
"2_datetime_update.json",
|
"2_datetime_update.sql",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
Migrate.migrate_location = "."
|
Migrate.migrate_location = "."
|
||||||
|
|
||||||
assert Migrate.get_all_version_files() == [
|
assert Migrate.get_all_version_files() == [
|
||||||
"1_datetime_update.json",
|
"1_datetime_update.sql",
|
||||||
"2_datetime_update.json",
|
"2_datetime_update.sql",
|
||||||
"10_datetime_update.json",
|
"10_datetime_update.sql",
|
||||||
"11_datetime_update.json",
|
"11_datetime_update.sql",
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user