-
Notifications
You must be signed in to change notification settings - Fork 28
Closed
Description
Given this input (as output from Doctrine, with trailing ; and newlines added)
CREATE TABLE /*_*/actor (actor_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, actor_user INT UNSIGNED DEFAULT NULL, actor_name VARBINARY(255) NOT NULL, UNIQUE INDEX actor_user (actor_user), UNIQUE INDEX actor_name (actor_name), PRIMARY KEY(actor_id)) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/user_former_groups (ufg_user INT UNSIGNED DEFAULT 0 NOT NULL, ufg_group VARBINARY(255) DEFAULT '' NOT NULL, PRIMARY KEY(ufg_user, ufg_group)) /*$wgDBTableOptions*/;
Calling ( new SqlFormatter( new NullHighlighter() ) )->format( $schema ); gives
CREATE TABLE
/*_*/
actor (
actor_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL,
actor_user INT UNSIGNED DEFAULT NULL,
actor_name VARBINARY(255) NOT NULL,
UNIQUE INDEX actor_user (actor_user),
UNIQUE INDEX actor_name (actor_name),
PRIMARY KEY(actor_id)
)
/*$wgDBTableOptions*/
; CREATE TABLE
/*_*/
user_former_groups (
ufg_user INT UNSIGNED DEFAULT 0 NOT NULL,
ufg_group VARBINARY(255) DEFAULT '' NOT NULL,
PRIMARY KEY(ufg_user, ufg_group)
)
/*$wgDBTableOptions*/
;
Is it possible to add some more newlines? https://github.com/doctrine/sql-formatter/blob/1.0.x/src/SqlFormatter.php#L49 obviously doesn't take any options
Similar for some postgres:
CREATE TABLE /*_*/actor (actor_id BIGSERIAL NOT NULL, actor_user INT DEFAULT NULL, actor_name BYTEA NOT NULL, PRIMARY KEY(actor_id));
CREATE UNIQUE INDEX actor_user ON /*_*/actor (actor_user);
CREATE UNIQUE INDEX actor_name ON /*_*/actor (actor_name);
CREATE TABLE /*_*/user_former_groups (ufg_user INT DEFAULT 0 NOT NULL, ufg_group BYTEA DEFAULT '' NOT NULL, PRIMARY KEY(ufg_user, ufg_group));
to
CREATE TABLE
/*_*/
actor (
actor_id BIGSERIAL NOT NULL,
actor_user INT DEFAULT NULL,
actor_name BYTEA NOT NULL,
PRIMARY KEY(actor_id)
); CREATE UNIQUE INDEX actor_user ON
/*_*/
actor (actor_user); CREATE UNIQUE INDEX actor_name ON
/*_*/
actor (actor_name); CREATE TABLE
/*_*/
user_former_groups (
ufg_user INT DEFAULT 0 NOT NULL,
ufg_group BYTEA DEFAULT '' NOT NULL,
PRIMARY KEY(ufg_user, ufg_group)
);
Metadata
Metadata
Assignees
Labels
No labels