DuckDbDialect

Struct DuckDbDialect 

Source
pub struct DuckDbDialect;
Expand description

DuckDB dialect for migration SQL generation.

DuckDB does not support AUTOINCREMENT or SERIAL/BIGSERIAL. Instead, auto-increment is implemented via CREATE SEQUENCE + DEFAULT nextval('seq_<table>_<column>'). The [create_table] override emits the sequence DDL automatically for every column marked with autoincrement.

Implementations§

Source§

impl DuckDbDialect

Source

pub const fn new() -> Self

Creates a new DuckDB dialect.

Trait Implementations§

Source§

impl Clone for DuckDbDialect

Source§

fn clone(&self) -> DuckDbDialect

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DuckDbDialect

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DuckDbDialect

Source§

fn default() -> DuckDbDialect

Returns the “default value” for a type. Read more
Source§

impl MigrationDialect for DuckDbDialect

Source§

fn name(&self) -> &'static str

Returns the dialect name.
Source§

fn map_data_type(&self, dt: &DataType) -> String

Maps a DataType to the dialect-specific SQL type.
Source§

fn autoincrement_keyword(&self) -> String

Returns the AUTOINCREMENT keyword for this dialect.
Source§

fn create_table(&self, op: &CreateTableOp) -> String

Generates SQL for CREATE TABLE.
Source§

fn render_default(&self, default: &DefaultValue) -> String

Renders a default value.
Source§

fn rename_table(&self, op: &RenameTableOp) -> String

Generates SQL for RENAME TABLE.
Source§

fn rename_column(&self, op: &RenameColumnOp) -> String

Generates SQL for RENAME COLUMN.
Source§

fn alter_column(&self, op: &AlterColumnOp) -> String

Generates SQL for ALTER COLUMN.
Source§

fn drop_index(&self, op: &DropIndexOp) -> String

Generates SQL for DROP INDEX.
Source§

fn drop_foreign_key(&self, op: &DropForeignKeyOp) -> String

Generates SQL for DROP FOREIGN KEY.
Source§

fn generate_sql(&self, operation: &Operation) -> String

Generates SQL for an operation.
Source§

fn drop_table(&self, op: &DropTableOp) -> String

Generates SQL for DROP TABLE.
Source§

fn add_column(&self, op: &AddColumnOp) -> String

Generates SQL for ADD COLUMN.
Source§

fn drop_column(&self, op: &DropColumnOp) -> String

Generates SQL for DROP COLUMN.
Source§

fn create_index(&self, op: &CreateIndexOp) -> String

Generates SQL for CREATE INDEX.
Source§

fn add_foreign_key(&self, op: &AddForeignKeyOp) -> String

Generates SQL for ADD FOREIGN KEY.
Source§

fn column_definition(&self, col: &ColumnDefinition) -> String

Generates SQL for a column definition.
Source§

fn table_constraint(&self, constraint: &TableConstraint) -> String

Generates SQL for a table constraint.
Source§

fn quote_char(&self) -> char

Returns the identifier quote character.
Source§

fn quote_identifier(&self, name: &str) -> String

Quotes an identifier.
Source§

fn index_type_sql(&self, index_type: &IndexType) -> &'static str

Maps an index type to SQL.
Source§

impl RustTypeMapping for DuckDbDialect

Source§

fn map_type(&self, rust_type: &str) -> DataType

Maps a Rust type name to the dialect-specific SQL data type.
Source§

impl Copy for DuckDbDialect

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.