Le 12.08.2015 18:22, Diab Jerius a écrit :
> I'm creating schema with SQL::Translator so that I can generate both
> DDL and DBIx::DataModel schema from a single source.
>
> I've attached the code which generates the DDL and the schema code, as
> well as its output.
>
> I'm running into a problem where DBIx::DataModel::Schema::Generator is
> emitting code which DBIx::DataModel is rejecting.
>
>
Hi Diab,
I had a look at your post and at your pull request.
I was able to reproduce the original problem. Indeed there seems to be a
bug when generating a DBIDM Schema from SQL::Translator; I still don't
know if the bug is in Schema::Generator.pm (most probably), or in
SQL::Translator. Anyway, this should probably be solved by changing the
"parse_SQL_Translator" function.
However, when loading the SQL in SQLite, and then generating the DBIDM
Schema through parse_DBI, I see no problem. So the path you took in the
pull request doesn't seem appropriate to me. Moreover, if there are
several "ON DELETE CASCADE"for several foreign keys to the same primary
key, it's most probably a sign of some defect within the database
structure, so I wouldn't change the Generator.pm for that; I think it's
better to generate an error, and if people have a very good reason for
overriding it, and they know what they are doing, then they can always
hand-edit the generated schema.
I hope you feel not frustrated with this answer, but I won't incorporate
the pull request.
I'll try to see what is wrong with the SQL::Translator generated code.
Best regards, Laurent Dami