Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add schema changes for length for postgres #185

Merged
merged 1 commit into from

5 participants

Miha Vrhovnik Don't Add Me To Your Organization a.k.a The Travis Bot Benjamin Eberlei Guilherme Blanco Christophe Coevoet
Miha Vrhovnik

No description provided.

Don't Add Me To Your Organization a.k.a The Travis Bot

This pull request passes (merged f9015602 into 8f783fb).

Don't Add Me To Your Organization a.k.a The Travis Bot

This pull request passes (merged f9015602 into 8f783fb).

lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
@@ -444,6 +444,11 @@ public function getAlterTableSQL(TableDiff $diff)
if ($columnDiff->hasChanged('comment') && $comment = $this->getColumnComment($column)) {
$commentsSQL[] = $this->getCommentOnColumnSQL($diff->name, $column->getName(), $comment);
}
+ if ($columnDiff->hasChanged('length')) {
Guilherme Blanco Owner

Missing line break

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
@@ -444,6 +444,11 @@ public function getAlterTableSQL(TableDiff $diff)
if ($columnDiff->hasChanged('comment') && $comment = $this->getColumnComment($column)) {
$commentsSQL[] = $this->getCommentOnColumnSQL($diff->name, $column->getName(), $comment);
}
+ if ($columnDiff->hasChanged('length')) {
+ // here was a server version check before, but DBAL API does not support this anymore.
Guilherme Blanco Owner

Comments should always start with upper cased letter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
@@ -444,6 +444,11 @@ public function getAlterTableSQL(TableDiff $diff)
if ($columnDiff->hasChanged('comment') && $comment = $this->getColumnComment($column)) {
$commentsSQL[] = $this->getCommentOnColumnSQL($diff->name, $column->getName(), $comment);
}
+ if ($columnDiff->hasChanged('length')) {
+ // here was a server version check before, but DBAL API does not support this anymore.
+ $query = 'ALTER ' . $column->getName() . ' TYPE ' . $column->getType()->getSqlDeclaration($column->toArray(), $this);
+ $sql[] = 'ALTER TABLE ' . $diff->name . ' ' . $query;
Guilherme Blanco Owner

Missing line break between the two logical blocks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Miha Vrhovnik

The comment is a remaining of copy/paste (I'll remove it). Regarding the other CS comments.. code uses same CS as the rest of the file. Do you still want me to fix it?

Miha Vrhovnik

I've removed the column, but left the CS as is

lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
@@ -619,6 +622,17 @@ public function getSmallIntTypeDeclarationSQL(array $field)
}
/**
+ * Decleration for a UUID field in PostgreSQL
+ *
+ * @param array $field
+ * @return string
+ */
+ public function getGuidTypeDeclartionSQL(array $field)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Benjamin Eberlei
Owner

@mvrhov pathfinder rule. leave the place better than it was before :-) No need to change everything though, but little steps. Can you also rebase to latest master? There is a conflict in the diff.

lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
((6 lines not shown))
} else {
- $whereClause .= "$classAlias.relname = '" . $table . "'";
+ $schema = "ANY(string_to_array((select setting from pg_catalog.pg_settings where name = 'search_path'),','))";
Guilherme Blanco Owner

Use uppercased keywords.
select => SELECT, etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Miha Vrhovnik

The problem with my previous commit was that I forgot to do a rebase.
This should be solved now....

Don't Add Me To Your Organization a.k.a The Travis Bot

This pull request passes (merged d0c00d3 into 24ec194).

Benjamin Eberlei beberlei merged commit 443af38 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 29, 2012
  1. Miha Vrhovnik
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
5 lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
View
@@ -407,6 +407,11 @@ public function getAlterTableSQL(TableDiff $diff)
if ($columnDiff->hasChanged('comment') && $comment = $this->getColumnComment($column)) {
$commentsSQL[] = $this->getCommentOnColumnSQL($diff->name, $column->getName(), $comment);
}
+
+ if ($columnDiff->hasChanged('length')) {
+ $query = 'ALTER ' . $column->getName() . ' TYPE ' . $column->getType()->getSqlDeclaration($column->toArray(), $this);
+ $sql[] = 'ALTER TABLE ' . $diff->name . ' ' . $query;
+ }
}
foreach ($diff->renamedColumns as $oldColumnName => $column) {
Something went wrong with that request. Please try again.