⭐️ If you like MikroORM, give it a star on GitHub and consider sponsoring its development! ⭐️
This is documentation for an unreleased version. For the latest API, see version 7.1.
Version: Next
normalizeViewDefinition
Callable
normalizeViewDefinition(definition): string
Strips SQL line comments and blank lines from a view definition. Comments are dropped by the
database on create view anyway, and a -- comment would otherwise comment out the rest of the
definition once newlines are collapsed; blank lines act as statement separators in the
schema-generator's statement splitter, which would break the view DDL apart.
Comment stripping is not string-literal aware, so a -- inside a string literal (or a--b style
arithmetic) is treated as a comment — an accepted tradeoff to avoid a full SQL tokenizer.
Strips SQL line comments and blank lines from a view definition. Comments are dropped by the database on
create viewanyway, and a--comment would otherwise comment out the rest of the definition once newlines are collapsed; blank lines act as statement separators in the schema-generator's statement splitter, which would break the view DDL apart.Comment stripping is not string-literal aware, so a
--inside a string literal (ora--bstyle arithmetic) is treated as a comment — an accepted tradeoff to avoid a full SQL tokenizer.https://github.com/mikro-orm/mikro-orm/issues/7875