Changeset 11247
- Timestamp:
- 08/30/08 00:12:06 (3 months ago)
- Files:
-
- plugins/sfPropelPlugin/branches/migration/lib/propel/builder/sql/SfmssqlDDLBuilder.php (modified) (1 diff)
- plugins/sfPropelPlugin/branches/migration/lib/propel/builder/sql/SfmysqlDDLBuilder.php (modified) (1 diff)
- plugins/sfPropelPlugin/branches/migration/lib/propel/builder/sql/SforacleDDLBuilder.php (modified) (1 diff)
- plugins/sfPropelPlugin/branches/migration/lib/propel/builder/sql/SfpgsqlDDLBuilder.php (modified) (1 diff)
- plugins/sfPropelPlugin/branches/migration/lib/propel/builder/sql/SfsqliteDDLBuilder.php (modified) (1 diff)
- plugins/sfPropelPlugin/branches/migration/lib/propel/migration/model/sfPropelIndex.class.php (modified) (3 diffs)
- plugins/sfPropelPlugin/branches/migration/lib/propel/migration/model/sfPropelTable.class.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfPropelPlugin/branches/migration/lib/propel/builder/sql/SfmssqlDDLBuilder.php
r11245 r11247 18 18 return $script; 19 19 } 20 21 public function getDropIndexStatement($tableName, $indexName, $indexType) 22 { 23 /** 24 * @todo Different syntax for dropping a unique index? 25 */ 26 return sprintf('DROP INDEX %s;', $this->quoteIdentifier($indexName)); 27 } 20 28 } plugins/sfPropelPlugin/branches/migration/lib/propel/builder/sql/SfmysqlDDLBuilder.php
r11245 r11247 18 18 return $script; 19 19 } 20 21 public function getDropIndexStatement($tableName, $indexName, $indexType) 22 { 23 return vsprintf('DROP INDEX %s ON %s;', array( 24 $this->quoteIdentifier($indexName), 25 $this->quoteIdentifier($this->prefixTablename($tableName)), 26 )); 27 } 20 28 } plugins/sfPropelPlugin/branches/migration/lib/propel/builder/sql/SforacleDDLBuilder.php
r11245 r11247 18 18 return $script; 19 19 } 20 21 public function getDropIndexStatement($tableName, $indexName, $indexType) 22 { 23 return sprintf('DROP INDEX %s;', $this->quoteIdentifier($indexName)); 24 } 20 25 } plugins/sfPropelPlugin/branches/migration/lib/propel/builder/sql/SfpgsqlDDLBuilder.php
r11245 r11247 18 18 return $script; 19 19 } 20 21 public function getDropIndexStatement($tableName, $indexName, $indexType) 22 { 23 return sprintf('DROP INDEX %s CASCADE;', $this->quoteIdentifier($indexName)); 24 } 20 25 } plugins/sfPropelPlugin/branches/migration/lib/propel/builder/sql/SfsqliteDDLBuilder.php
r11245 r11247 18 18 return $script; 19 19 } 20 21 public function getDropIndexStatement($tableName, $indexName, $indexType) 22 { 23 return sprintf('DROP INDEX %s;', $this->quoteIdentifier($indexName)); 24 } 20 25 } plugins/sfPropelPlugin/branches/migration/lib/propel/migration/model/sfPropelIndex.class.php
r11242 r11247 82 82 $indexClass = $this->type; 83 83 $index = new $indexClass; 84 $index->setName($this->name); 84 85 85 86 $columns = array_combine(array_map(create_function('$c', 'return $c->getName();'), $columns), $columns); … … 108 109 $builder = $this->getBuilder($table->asPropel()); 109 110 110 $script = vsprintf('CREATE %sINDEX %s ON %s (%s);', array( 111 $script = $builder->getDatabaseStartDDL(); 112 $script .= vsprintf('CREATE %sINDEX %s ON %s (%s);', array( 111 113 'unique' == $this->type ? 'UNIQUE ' : '', 112 114 $builder->quoteIdentifier($this->name), … … 114 116 $this->getColumnList($builder), 115 117 )); 118 $script .= $builder->getDatabaseEndDDL(); 116 119 117 return $builder->getDatabaseStartDDL()."\n".$script."\n".$builder->getDatabaseEndDDL(); 120 return $script; 121 } 122 123 public function asDropSql(sfPropelTable $table) 124 { 125 $builder = $this->getBuilder($table->asPropel()); 126 127 $script = $builder->getDatabaseStartDDL(); 128 $script .= $builder->getDropIndexStatement($table->getName(), $this->name, $this->type); 129 $script .= $builder->getDatabaseEndDDL(); 130 131 return $script; 118 132 } 119 133 plugins/sfPropelPlugin/branches/migration/lib/propel/migration/model/sfPropelTable.class.php
r11245 r11247 97 97 } 98 98 99 $table->doFinalInitialization(); 100 99 101 return $table; 100 102 } … … 102 104 public function asCreateSql() 103 105 { 104 $table = $this->asPropel(); 105 $table->setDatabase($this->getDatabase()); 106 $table->doFinalInitialization(); 107 108 $builder = $this->getBuilder($table); 106 $builder = $this->getBuilder($this->asPropel()); 109 107 110 108 $script = $builder->getDatabaseStartDDL(); … … 117 115 public function asDropSql() 118 116 { 119 $table = $this->asPropel(); 120 $table->setDatabase($this->getDatabase()); 121 $table->doFinalInitialization(); 122 123 $builder = $this->getBuilder($table); 117 $builder = $this->getBuilder($this->asPropel()); 124 118 125 119 $script = $builder->getDatabaseStartDDL();