MCPcopy Create free account
hub / github.com/belchior/sql_query_builder / rename

Method rename

src/alter_table/alter_table.rs:343–355  ·  view source on GitHub ↗

Changes the column name or table constraints, this method overrides the previous value ### Example ``` # #[cfg(any(feature = "postgresql", feature = "sqlite", feature = "mysql"))] # { # use sql_query_builder as sql; let query = sql::AlterTable::new() .alter_table("users") .rename("COLUMN address TO city") .to_string(); # let expected = "ALTER TABLE users RENAME COLUMN address TO city"; # assert

(mut self, action: &str)

Source from the content-addressed store, hash-verified

341 /// RENAME COLUMN name TO full_name
342 /// ```
343 pub fn rename(mut self, action: &str) -> Self {
344 #[cfg(feature = "mysql")]
345 {
346 let action = AlterTableActionItem(AlterTableOrderedAction::Rename, action.trim().to_string());
347 push_unique(&mut self._ordered_actions, action);
348 }
349 #[cfg(not(feature = "mysql"))]
350 {
351 self._rename = action.trim().to_string();
352 }
353
354 self
355 }
356}
357
358#[cfg(any(doc, feature = "postgresql", feature = "sqlite"))]

Calls 2

push_uniqueFunction · 0.85