Support drop column for sqlite. (#40)
				
					
				
			This commit is contained in:
		| @@ -6,6 +6,7 @@ | ||||
|  | ||||
| - Fix incorrect index creation order. (#151) | ||||
| - Not catch exception when import config. (#164) | ||||
| - Support `drop column` for sqlite. (#40) | ||||
|  | ||||
| ### 0.5.3 | ||||
|  | ||||
|   | ||||
| @@ -23,6 +23,7 @@ from aerich.utils import ( | ||||
|     get_version_content_from_file, | ||||
|     write_version_file, | ||||
| ) | ||||
|  | ||||
| from . import __version__ | ||||
| from .enums import Color | ||||
| from .models import Aerich | ||||
|   | ||||
| @@ -11,9 +11,6 @@ class SqliteDDL(BaseDDL): | ||||
|     schema_generator_cls = SqliteSchemaGenerator | ||||
|     DIALECT = SqliteSchemaGenerator.DIALECT | ||||
|  | ||||
|     def drop_column(self, model: "Type[Model]", column_name: str): | ||||
|         raise NotSupportError("Drop column is unsupported in SQLite.") | ||||
|  | ||||
|     def modify_column(self, model: "Type[Model]", field_object: dict, is_pk: bool = True): | ||||
|         raise NotSupportError("Modify column is unsupported in SQLite.") | ||||
|  | ||||
|   | ||||
| @@ -5,7 +5,7 @@ import sys | ||||
| from pathlib import Path | ||||
| from typing import Dict | ||||
|  | ||||
| from click import BadOptionUsage, Context, ClickException | ||||
| from click import BadOptionUsage, ClickException, Context | ||||
| from tortoise import BaseDBAsyncClient, Tortoise | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -1,9 +1,6 @@ | ||||
| import pytest | ||||
|  | ||||
| from aerich.ddl.mysql import MysqlDDL | ||||
| from aerich.ddl.postgres import PostgresDDL | ||||
| from aerich.ddl.sqlite import SqliteDDL | ||||
| from aerich.exceptions import NotSupportError | ||||
| from aerich.migrate import Migrate | ||||
| from tests.models import Category, Product, User | ||||
|  | ||||
| @@ -144,11 +141,7 @@ def test_set_comment(): | ||||
|  | ||||
|  | ||||
| def test_drop_column(): | ||||
|     if isinstance(Migrate.ddl, SqliteDDL): | ||||
|         with pytest.raises(NotSupportError): | ||||
|             ret = Migrate.ddl.drop_column(Category, "name") | ||||
|     else: | ||||
|         ret = Migrate.ddl.drop_column(Category, "name") | ||||
|     ret = Migrate.ddl.drop_column(Category, "name") | ||||
|     if isinstance(Migrate.ddl, MysqlDDL): | ||||
|         assert ret == "ALTER TABLE `category` DROP COLUMN `name`" | ||||
|     elif isinstance(Migrate.ddl, PostgresDDL): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user