Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Add schema changes for length for postgres #185

Merged
merged 1 commit into from over 1 year ago

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)
444 444
             if ($columnDiff->hasChanged('comment') && $comment = $this->getColumnComment($column)) {
445 445
                 $commentsSQL[] = $this->getCommentOnColumnSQL($diff->name, $column->getName(), $comment);
446 446
             }
  447
+            if ($columnDiff->hasChanged('length')) {
1
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)
444 444
             if ($columnDiff->hasChanged('comment') && $comment = $this->getColumnComment($column)) {
445 445
                 $commentsSQL[] = $this->getCommentOnColumnSQL($diff->name, $column->getName(), $comment);
446 446
             }
  447
+            if ($columnDiff->hasChanged('length')) {
  448
+                // here was a server version check before, but DBAL API does not support this anymore.
1
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)
444 444
             if ($columnDiff->hasChanged('comment') && $comment = $this->getColumnComment($column)) {
445 445
                 $commentsSQL[] = $this->getCommentOnColumnSQL($diff->name, $column->getName(), $comment);
446 446
             }
  447
+            if ($columnDiff->hasChanged('length')) {
  448
+                // here was a server version check before, but DBAL API does not support this anymore.
  449
+                $query = 'ALTER ' . $column->getName() . ' TYPE ' . $column->getType()->getSqlDeclaration($column->toArray(), $this);
  450
+                $sql[] = 'ALTER TABLE ' . $diff->name . ' ' . $query;
1
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)
619 622
     }
620 623
 
621 624
     /**
  625
+     * Decleration for a UUID field in PostgreSQL
  626
+     *
  627
+     * @param array $field
  628
+     * @return string
  629
+     */
  630
+    public function getGuidTypeDeclartionSQL(array $field)
1
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))
273 273
         } else {
274  
-            $whereClause .= "$classAlias.relname = '" . $table . "'";
  274
+            $schema = "ANY(string_to_array((select setting from pg_catalog.pg_settings where name = 'search_path'),','))";
1
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 October 06, 2012
Benjamin Eberlei beberlei closed this October 06, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Aug 30, 2012
Miha Vrhovnik Add schema changes for length for postgres d0c00d3
This page is out of date. Refresh to see the latest.
5  lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
@@ -407,6 +407,11 @@ public function getAlterTableSQL(TableDiff $diff)
407 407
             if ($columnDiff->hasChanged('comment') && $comment = $this->getColumnComment($column)) {
408 408
                 $commentsSQL[] = $this->getCommentOnColumnSQL($diff->name, $column->getName(), $comment);
409 409
             }
  410
+
  411
+            if ($columnDiff->hasChanged('length')) {
  412
+                $query = 'ALTER ' . $column->getName() . ' TYPE ' . $column->getType()->getSqlDeclaration($column->toArray(), $this);
  413
+                $sql[] = 'ALTER TABLE ' . $diff->name . ' ' . $query;
  414
+            }
410 415
         }
411 416
 
412 417
         foreach ($diff->renamedColumns as $oldColumnName => $column) {
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.