Changeset 9213
- Timestamp:
- 05/23/08 15:56:57 (5 years ago)
- Files:
-
- plugins/sfPropelMigrationsLightPlugin/trunk/README (modified) (1 diff)
- plugins/sfPropelMigrationsLightPlugin/trunk/lib/sfMigration.class.php (modified) (1 diff)
- plugins/sfPropelMigrationsLightPlugin/trunk/package-sfPropelMigrationsLightPlugin.xml (added)
- plugins/sfPropelMigrationsLightPlugin/trunk/package.xml (deleted)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfPropelMigrationsLightPlugin/trunk/README
r5483 r9213 80 80 == Changelog == 81 81 82 === 2008-05-23 | 1.0.1 === 83 * develop7: fixed syntax error in sfMigration::addColumn() 84 82 85 === 2007-10-12 | 0.5.0 Beta === 83 86 plugins/sfPropelMigrationsLightPlugin/trunk/lib/sfMigration.class.php
r5736 r9213 97 97 98 98 /** 99 * adds a column to an existing table [untested]99 * Adds a column to an existing table 100 100 * 101 * @param string $tablethe table name102 * @param string $columnthe name of the column to add103 * @param string $typethe type of the column to add104 * @param bool$notNull if the column should be NOT NULL105 * @param mixed$default default value for the column101 * @param string $table the table name 102 * @param string $column the name of the column to add 103 * @param string $type the type of the column to add 104 * @param bool $notNull if the column should be NOT NULL 105 * @param mixed $default default value for the column 106 106 */ 107 107 protected function addColumn($table, $column, $type, $notNull = false, $default = null) 108 108 { 109 109 $sql = "ALTER TABLE $table ADD COLUMN $column $type"; 110 if ($notNull) { $sql += " NOT NULL"; } 110 if ($notNull) { 111 $sql .= " NOT NULL"; 112 } 111 113 if ($default !== null) { 112 if (!is_int($default)) { $default = "'" . $default . "'"; } 113 $sql += " DEFAULT $default"; 114 if (!is_int($default)) { 115 $default = "'" . $default . "'"; 116 } 117 $sql .= " DEFAULT $default"; 114 118 } 115 119