Returns SQL to rename a column in a table.
(tableName: string, oldColumnName: string, to: Column, schemaName?: string)
| 221 | |
| 222 | /** Returns SQL to rename a column in a table. */ |
| 223 | getRenameColumnSQL(tableName: string, oldColumnName: string, to: Column, schemaName?: string): string { |
| 224 | tableName = this.quote(tableName); |
| 225 | oldColumnName = this.quote(oldColumnName); |
| 226 | const columnName = this.quote(to.name); |
| 227 | |
| 228 | const schemaReference = schemaName !== undefined && schemaName !== 'public' ? '"' + schemaName + '".' : ''; |
| 229 | const tableReference = schemaReference + tableName; |
| 230 | |
| 231 | return `alter table ${tableReference} rename column ${oldColumnName} to ${columnName}`; |
| 232 | } |
| 233 | |
| 234 | /** Returns SQL to create an index on a table. */ |
| 235 | getCreateIndexSQL(tableName: string, index: IndexDef): string { |