sql-formatter
sql-formatter copied to clipboard
A lightweight php class for formatting sql statements. Handles automatic indentation and syntax highlighting.
I have the following Column definition in my Symfony project ```php #[ORM\Entity] class Queue { [...] #[ORM\Column( insertable: false, updatable: false, columnDefinition: 'SERIAL', )] private ?int $autoIncrement = null; [...]...
At the moment, even though valid, these kind of queries would crash doctrine-bundle + twig ```php $connection->executeQuery("SELECT {$connection->quote((new \Symfony\Component\Uid\Ulid())->toBinary())}"); ``` We are running all of these queries through this formatter,...
It should not start a new line before and after the "SET" like it does here:   Here's the raw query for the 2nd example: `ALTER TABLE o2_test ADD...
Fixed lots of issues with formatting non-trivial SQL queries. This is NOT backwards compatible, there are many breaking changes. This is more in line with what looks good to me...
This adds a new optional third parameter to the `format` method, `$forceUppercase` which defaults to `false` to maintain backwards compatibility. When passed as `true`, all keywords will be uppercased. There...
Hi, it's often more readable when selected column aliases are aligned vertically. Instead of this: SELECT foo as one foofoo as two foofoofoo as three we can have this: SELECT...
See https://github.com/jdorn/sql-formatter/issues/97 and https://github.com/jdorn/sql-formatter/issues/84
In this example, why doesn't `ct_tag_id` end up on a new row? Given ```lang=sql CREATE TABLE /*_*/change_tag (ct_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, ct_rc_id INTEGER UNSIGNED DEFAULT NULL, ct_log_id...
Given this input (as output from Doctrine, with trailing ; and newlines added) ```lang=sql CREATE TABLE /*_*/actor (actor_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, actor_user INT UNSIGNED DEFAULT NULL, actor_name VARBINARY(255)...
See https://github.com/jdorn/sql-formatter/issues/68