emmett-framework / emmett

The web framework for inventors

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug in migration alter field with MSSQL Server

josejachuf opened this issue · comments

I do not know if the idea is to support MSSQL Server, as I said in another post, I am not a user, but now circumstantially I touch myself.

I report the case in which a field is modified and an error occurs.

In this case the width of a string field from 30 to 500 will be changed, for example. The generated SQL is:

ALTER TABLE "mytable" ALTER COLUMN "myfield" TYPE VARCHAR(60);

Should be the following, without TYPE

ALTER TABLE "mytable" ALTER COLUMN "myfield" VARCHAR(60);

The code is here [1], but I do not know how to refer to the database engine

Best Regards
Jose

[1]

def _alter_column_sql(self, table_name, column_name, changes):

@josejachuf this would need a bit of refactoring of the migrations code in order to use dialects to construct queries. To be honest when I firstly designed it I ensured the code worked on sqlite and postgres.

I'm not sure I'll be able to include this in 2.3, let's see.

Thanks @gi0baro

For me it reaches with SQLite and PostgreSQL. All I have reported from MSSQL Server is so that it is registered that there is a bug. Everything is solvable doing it "by hand"