Permalink
Browse files

database schema update!

SQL-Diff:
ALTER TABLE user ADD COLUMN `deleted` TINYINT(1) DEFAULT 0 AFTER `role`;
  • Loading branch information...
1 parent 4107394 commit c6437a692fb53e6c6adf56997da25d9c6f25f55d @gka gka committed Aug 19, 2012
@@ -50,6 +50,7 @@ public function initialize()
2 => 'pending',
3 => 'guest',
));
+ $this->addColumn('DELETED', 'Deleted', 'BOOLEAN', false, 1, false);
$this->addColumn('LANGUAGE', 'Language', 'VARCHAR', false, 5, 'en');
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
$this->addColumn('NAME', 'Name', 'VARCHAR', false, 512, null);
@@ -67,6 +67,13 @@
*/
protected $role;
+ /**
+ * The value for the deleted field.
+ * Note: this column has a database default value of: false
+ * @var boolean
+ */
+ protected $deleted;
+
/**
* The value for the language field.
* Note: this column has a database default value of: 'en'
@@ -143,6 +150,7 @@
public function applyDefaultValues()
{
$this->role = 2;
+ $this->deleted = false;
$this->language = 'en';
}
@@ -223,6 +231,16 @@ public function getRole()
return $valueSet[$this->role];
}
+ /**
+ * Get the [deleted] column value.
+ *
+ * @return boolean
+ */
+ public function getDeleted()
+ {
+ return $this->deleted;
+ }
+
/**
* Get the [language] column value.
*
@@ -425,6 +443,34 @@ public function setRole($v)
return $this;
} // setRole()
+ /**
+ * Sets the value of the [deleted] column.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ *
+ * @param boolean|integer|string $v The new value
+ * @return User The current object (for fluent API support)
+ */
+ public function setDeleted($v)
+ {
+ if ($v !== null) {
+ if (is_string($v)) {
+ $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ } else {
+ $v = (boolean) $v;
+ }
+ }
+
+ if ($this->deleted !== $v) {
+ $this->deleted = $v;
+ $this->modifiedColumns[] = UserPeer::DELETED;
+ }
+
+ return $this;
+ } // setDeleted()
+
/**
* Set the value of [language] column.
*
@@ -541,6 +587,10 @@ public function hasOnlyDefaultValues()
return false;
}
+ if ($this->deleted !== false) {
+ return false;
+ }
+
if ($this->language !== 'en') {
return false;
}
@@ -573,11 +623,12 @@ public function hydrate($row, $startcol = 0, $rehydrate = false)
$this->activate_token = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
$this->reset_password_token = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
$this->role = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
- $this->language = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
- $this->created_at = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
- $this->name = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
- $this->website = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
- $this->sm_profile = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
+ $this->deleted = ($row[$startcol + 6] !== null) ? (boolean) $row[$startcol + 6] : null;
+ $this->language = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
+ $this->created_at = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
+ $this->name = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
+ $this->website = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
+ $this->sm_profile = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null;
$this->resetModified();
$this->setNew(false);
@@ -586,7 +637,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false)
$this->ensureConsistency();
}
- return $startcol + 11; // 11 = UserPeer::NUM_HYDRATE_COLUMNS.
+ return $startcol + 12; // 12 = UserPeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating User object", $e);
@@ -850,6 +901,9 @@ protected function doInsert(PropelPDO $con)
if ($this->isColumnModified(UserPeer::ROLE)) {
$modifiedColumns[':p' . $index++] = '`ROLE`';
}
+ if ($this->isColumnModified(UserPeer::DELETED)) {
+ $modifiedColumns[':p' . $index++] = '`DELETED`';
+ }
if ($this->isColumnModified(UserPeer::LANGUAGE)) {
$modifiedColumns[':p' . $index++] = '`LANGUAGE`';
}
@@ -894,6 +948,9 @@ protected function doInsert(PropelPDO $con)
case '`ROLE`':
$stmt->bindValue($identifier, $this->role, PDO::PARAM_INT);
break;
+ case '`DELETED`':
+ $stmt->bindValue($identifier, (int) $this->deleted, PDO::PARAM_INT);
+ break;
case '`LANGUAGE`':
$stmt->bindValue($identifier, $this->language, PDO::PARAM_STR);
break;
@@ -1074,18 +1131,21 @@ public function getByPosition($pos)
return $this->getRole();
break;
case 6:
- return $this->getLanguage();
+ return $this->getDeleted();
break;
case 7:
- return $this->getCreatedAt();
+ return $this->getLanguage();
break;
case 8:
- return $this->getName();
+ return $this->getCreatedAt();
break;
case 9:
- return $this->getWebsite();
+ return $this->getName();
break;
case 10:
+ return $this->getWebsite();
+ break;
+ case 11:
return $this->getSmProfile();
break;
default:
@@ -1123,11 +1183,12 @@ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColum
$keys[3] => $this->getActivateToken(),
$keys[4] => $this->getResetPasswordToken(),
$keys[5] => $this->getRole(),
- $keys[6] => $this->getLanguage(),
- $keys[7] => $this->getCreatedAt(),
- $keys[8] => $this->getName(),
- $keys[9] => $this->getWebsite(),
- $keys[10] => $this->getSmProfile(),
+ $keys[6] => $this->getDeleted(),
+ $keys[7] => $this->getLanguage(),
+ $keys[8] => $this->getCreatedAt(),
+ $keys[9] => $this->getName(),
+ $keys[10] => $this->getWebsite(),
+ $keys[11] => $this->getSmProfile(),
);
if ($includeForeignObjects) {
if (null !== $this->collCharts) {
@@ -1190,18 +1251,21 @@ public function setByPosition($pos, $value)
$this->setRole($value);
break;
case 6:
- $this->setLanguage($value);
+ $this->setDeleted($value);
break;
case 7:
- $this->setCreatedAt($value);
+ $this->setLanguage($value);
break;
case 8:
- $this->setName($value);
+ $this->setCreatedAt($value);
break;
case 9:
- $this->setWebsite($value);
+ $this->setName($value);
break;
case 10:
+ $this->setWebsite($value);
+ break;
+ case 11:
$this->setSmProfile($value);
break;
} // switch()
@@ -1234,11 +1298,12 @@ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
if (array_key_exists($keys[3], $arr)) $this->setActivateToken($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setResetPasswordToken($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setRole($arr[$keys[5]]);
- if (array_key_exists($keys[6], $arr)) $this->setLanguage($arr[$keys[6]]);
- if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]);
- if (array_key_exists($keys[8], $arr)) $this->setName($arr[$keys[8]]);
- if (array_key_exists($keys[9], $arr)) $this->setWebsite($arr[$keys[9]]);
- if (array_key_exists($keys[10], $arr)) $this->setSmProfile($arr[$keys[10]]);
+ if (array_key_exists($keys[6], $arr)) $this->setDeleted($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setLanguage($arr[$keys[7]]);
+ if (array_key_exists($keys[8], $arr)) $this->setCreatedAt($arr[$keys[8]]);
+ if (array_key_exists($keys[9], $arr)) $this->setName($arr[$keys[9]]);
+ if (array_key_exists($keys[10], $arr)) $this->setWebsite($arr[$keys[10]]);
+ if (array_key_exists($keys[11], $arr)) $this->setSmProfile($arr[$keys[11]]);
}
/**
@@ -1256,6 +1321,7 @@ public function buildCriteria()
if ($this->isColumnModified(UserPeer::ACTIVATE_TOKEN)) $criteria->add(UserPeer::ACTIVATE_TOKEN, $this->activate_token);
if ($this->isColumnModified(UserPeer::RESET_PASSWORD_TOKEN)) $criteria->add(UserPeer::RESET_PASSWORD_TOKEN, $this->reset_password_token);
if ($this->isColumnModified(UserPeer::ROLE)) $criteria->add(UserPeer::ROLE, $this->role);
+ if ($this->isColumnModified(UserPeer::DELETED)) $criteria->add(UserPeer::DELETED, $this->deleted);
if ($this->isColumnModified(UserPeer::LANGUAGE)) $criteria->add(UserPeer::LANGUAGE, $this->language);
if ($this->isColumnModified(UserPeer::CREATED_AT)) $criteria->add(UserPeer::CREATED_AT, $this->created_at);
if ($this->isColumnModified(UserPeer::NAME)) $criteria->add(UserPeer::NAME, $this->name);
@@ -1328,6 +1394,7 @@ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
$copyObj->setActivateToken($this->getActivateToken());
$copyObj->setResetPasswordToken($this->getResetPasswordToken());
$copyObj->setRole($this->getRole());
+ $copyObj->setDeleted($this->getDeleted());
$copyObj->setLanguage($this->getLanguage());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setName($this->getName());
@@ -1727,6 +1794,7 @@ public function clear()
$this->activate_token = null;
$this->reset_password_token = null;
$this->role = null;
+ $this->deleted = null;
$this->language = null;
$this->created_at = null;
$this->name = null;
@@ -23,13 +23,13 @@
const TM_CLASS = 'UserTableMap';
/** The total number of columns. */
- const NUM_COLUMNS = 11;
+ const NUM_COLUMNS = 12;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
- const NUM_HYDRATE_COLUMNS = 11;
+ const NUM_HYDRATE_COLUMNS = 12;
/** the column name for the ID field */
const ID = 'user.ID';
@@ -49,6 +49,9 @@
/** the column name for the ROLE field */
const ROLE = 'user.ROLE';
+ /** the column name for the DELETED field */
+ const DELETED = 'user.DELETED';
+
/** the column name for the LANGUAGE field */
const LANGUAGE = 'user.LANGUAGE';
@@ -89,12 +92,12 @@
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('Id', 'Email', 'Pwd', 'ActivateToken', 'ResetPasswordToken', 'Role', 'Language', 'CreatedAt', 'Name', 'Website', 'SmProfile', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'email', 'pwd', 'activateToken', 'resetPasswordToken', 'role', 'language', 'createdAt', 'name', 'website', 'smProfile', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::EMAIL, self::PWD, self::ACTIVATE_TOKEN, self::RESET_PASSWORD_TOKEN, self::ROLE, self::LANGUAGE, self::CREATED_AT, self::NAME, self::WEBSITE, self::SM_PROFILE, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'EMAIL', 'PWD', 'ACTIVATE_TOKEN', 'RESET_PASSWORD_TOKEN', 'ROLE', 'LANGUAGE', 'CREATED_AT', 'NAME', 'WEBSITE', 'SM_PROFILE', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'email', 'pwd', 'activate_token', 'reset_password_token', 'role', 'language', 'created_at', 'name', 'website', 'sm_profile', ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
+ BasePeer::TYPE_PHPNAME => array ('Id', 'Email', 'Pwd', 'ActivateToken', 'ResetPasswordToken', 'Role', 'Deleted', 'Language', 'CreatedAt', 'Name', 'Website', 'SmProfile', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'email', 'pwd', 'activateToken', 'resetPasswordToken', 'role', 'deleted', 'language', 'createdAt', 'name', 'website', 'smProfile', ),
+ BasePeer::TYPE_COLNAME => array (self::ID, self::EMAIL, self::PWD, self::ACTIVATE_TOKEN, self::RESET_PASSWORD_TOKEN, self::ROLE, self::DELETED, self::LANGUAGE, self::CREATED_AT, self::NAME, self::WEBSITE, self::SM_PROFILE, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'EMAIL', 'PWD', 'ACTIVATE_TOKEN', 'RESET_PASSWORD_TOKEN', 'ROLE', 'DELETED', 'LANGUAGE', 'CREATED_AT', 'NAME', 'WEBSITE', 'SM_PROFILE', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'email', 'pwd', 'activate_token', 'reset_password_token', 'role', 'deleted', 'language', 'created_at', 'name', 'website', 'sm_profile', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
);
/**
@@ -104,12 +107,12 @@
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Email' => 1, 'Pwd' => 2, 'ActivateToken' => 3, 'ResetPasswordToken' => 4, 'Role' => 5, 'Language' => 6, 'CreatedAt' => 7, 'Name' => 8, 'Website' => 9, 'SmProfile' => 10, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'email' => 1, 'pwd' => 2, 'activateToken' => 3, 'resetPasswordToken' => 4, 'role' => 5, 'language' => 6, 'createdAt' => 7, 'name' => 8, 'website' => 9, 'smProfile' => 10, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::EMAIL => 1, self::PWD => 2, self::ACTIVATE_TOKEN => 3, self::RESET_PASSWORD_TOKEN => 4, self::ROLE => 5, self::LANGUAGE => 6, self::CREATED_AT => 7, self::NAME => 8, self::WEBSITE => 9, self::SM_PROFILE => 10, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'EMAIL' => 1, 'PWD' => 2, 'ACTIVATE_TOKEN' => 3, 'RESET_PASSWORD_TOKEN' => 4, 'ROLE' => 5, 'LANGUAGE' => 6, 'CREATED_AT' => 7, 'NAME' => 8, 'WEBSITE' => 9, 'SM_PROFILE' => 10, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'email' => 1, 'pwd' => 2, 'activate_token' => 3, 'reset_password_token' => 4, 'role' => 5, 'language' => 6, 'created_at' => 7, 'name' => 8, 'website' => 9, 'sm_profile' => 10, ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Email' => 1, 'Pwd' => 2, 'ActivateToken' => 3, 'ResetPasswordToken' => 4, 'Role' => 5, 'Deleted' => 6, 'Language' => 7, 'CreatedAt' => 8, 'Name' => 9, 'Website' => 10, 'SmProfile' => 11, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'email' => 1, 'pwd' => 2, 'activateToken' => 3, 'resetPasswordToken' => 4, 'role' => 5, 'deleted' => 6, 'language' => 7, 'createdAt' => 8, 'name' => 9, 'website' => 10, 'smProfile' => 11, ),
+ BasePeer::TYPE_COLNAME => array (self::ID => 0, self::EMAIL => 1, self::PWD => 2, self::ACTIVATE_TOKEN => 3, self::RESET_PASSWORD_TOKEN => 4, self::ROLE => 5, self::DELETED => 6, self::LANGUAGE => 7, self::CREATED_AT => 8, self::NAME => 9, self::WEBSITE => 10, self::SM_PROFILE => 11, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'EMAIL' => 1, 'PWD' => 2, 'ACTIVATE_TOKEN' => 3, 'RESET_PASSWORD_TOKEN' => 4, 'ROLE' => 5, 'DELETED' => 6, 'LANGUAGE' => 7, 'CREATED_AT' => 8, 'NAME' => 9, 'WEBSITE' => 10, 'SM_PROFILE' => 11, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'email' => 1, 'pwd' => 2, 'activate_token' => 3, 'reset_password_token' => 4, 'role' => 5, 'deleted' => 6, 'language' => 7, 'created_at' => 8, 'name' => 9, 'website' => 10, 'sm_profile' => 11, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
);
/** The enumerated values for this table */
@@ -216,6 +219,7 @@ public static function addSelectColumns(Criteria $criteria, $alias = null)
$criteria->addSelectColumn(UserPeer::ACTIVATE_TOKEN);
$criteria->addSelectColumn(UserPeer::RESET_PASSWORD_TOKEN);
$criteria->addSelectColumn(UserPeer::ROLE);
+ $criteria->addSelectColumn(UserPeer::DELETED);
$criteria->addSelectColumn(UserPeer::LANGUAGE);
$criteria->addSelectColumn(UserPeer::CREATED_AT);
$criteria->addSelectColumn(UserPeer::NAME);
@@ -228,6 +232,7 @@ public static function addSelectColumns(Criteria $criteria, $alias = null)
$criteria->addSelectColumn($alias . '.ACTIVATE_TOKEN');
$criteria->addSelectColumn($alias . '.RESET_PASSWORD_TOKEN');
$criteria->addSelectColumn($alias . '.ROLE');
+ $criteria->addSelectColumn($alias . '.DELETED');
$criteria->addSelectColumn($alias . '.LANGUAGE');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.NAME');
Oops, something went wrong.

0 comments on commit c6437a6

Please sign in to comment.