Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

fix column names in versionable with Postgres #693

Open
wants to merge 1 commit into from

3 participants

@kcivey

When using Postgres, the versionable behavior produces invalid column names for the *_ids and *_versions columns, because the foreign table name it uses as a prefix includes the Postgres schema name and a dot. This pull request uses getCommonName() instead of getName() for the table name when generating the column names, thus leaving off the schema prefix.

This replaces the pull request submitted a while back as #498.

@staabm
Collaborator

could you add a testcase which fails without your patch?

@willdurand
Owner

well yeah, a test case would be nice.

@willdurand
Owner

ping @kcivey

@kcivey

Sorry, I haven't had time to figure out the testing yet. It looks like the Versionable tests all use a SQLite database, but I guess I can stick a Versionable test into the Postgres testing.

@crzdeveloper crzdeveloper referenced this pull request from a commit in crzdeveloper/propel-versionable
@crzdeveloper crzdeveloper Fix from issue propelorm/Propel#693 65694eb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 22, 2013
  1. @kcivey

    fix invalid id and version column names (with schema prefix) generate…

    kcivey authored
    …d from Versionable with Postgres
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 3 deletions.
  1. +3 −3 generator/lib/behavior/versionable/VersionableBehavior.php
View
6 generator/lib/behavior/versionable/VersionableBehavior.php
@@ -165,7 +165,7 @@ public function addForeignKeyVersionColumns()
}
foreach ($this->getVersionableReferrers() as $fk) {
- $fkTableName = $fk->getTable()->getName();
+ $fkTableName = $fk->getTable()->getCommonName();
if ($fk->isLocalPrimaryKey()) {
$columns = array(
@@ -236,7 +236,7 @@ public function getVersionableReferrers()
public function getReferrerIdsColumn(ForeignKey $fk)
{
- $fkTableName = $fk->getTable()->getName();
+ $fkTableName = $fk->getTable()->getCommonName();
if ($fk->isLocalPrimaryKey()) {
$fkColumnName = $fkTableName . '_id';
@@ -249,7 +249,7 @@ public function getReferrerIdsColumn(ForeignKey $fk)
public function getReferrerVersionsColumn(ForeignKey $fk)
{
- $fkTableName = $fk->getTable()->getName();
+ $fkTableName = $fk->getTable()->getCommonName();
if ($fk->isLocalPrimaryKey()) {
$fkColumnName = $fkTableName . '_version';
Something went wrong with that request. Please try again.