AnatolyUss/nmig

Error converting Views

ayh20 opened this issue · 3 comments

ayh20 commented

In the MySQL DB i have a set of views and conversion fails on them with a syntax error..

In MySQL the view is:
select tracks.id AS id,tracks.name AS name,best_laps.laptime AS laptime from (best_laps join tracks on((best_laps.id = tracks.id)))

nmig throws the following error:

--[ViewGenerator] error: syntax error at or near "("

SQL: CREATE OR REPLACE VIEW "public"."fastestlaps" AS select "tracks"."id" AS "id","tracks"."name" AS "name","best_laps"."laptime" AS "laptime" from "public".("best_laps" join "public"."tracks" on(("best_laps"."id" = "tracks"."id")));

the SQL generated has the bracket misplaced ... it should be before "public". so the correct string should be:
CREATE OR REPLACE VIEW "public"."fastestlaps" AS select "tracks"."id" AS "id","tracks"."name" AS "name","best_laps"."laptime" AS "laptime" from ("public"."best_laps" join "public"."tracks" on(("best_laps"."id" = "tracks"."id")));

ayh20 commented

ALSO ....

When it fails it tries to create a SQL file in a directory called: nmig\logs_directory\not_created_views

The first error works .... the rest fail with:

    --[logNotCreatedView] Error: EEXIST: file already exists, mkdir 'C:\Users\ahampshi\Downloads\nmig\logs_directory\not_created_views'

Failed views logging is fixed.
Thanks