Rust

mysql

Module

[MySql]: the MySQL / MariaDB schema.

Contents

use utopia_query::schema::mysql::MySql;
Rust
pub struct MySql

The MySQL schema: backtick quoting, AUTO_INCREMENT, inline indexes, PARTITION BY ... PARTITIONS n.

Rust
use utopia_query::schema::{MySql, Schema};

let schema = MySql::new();
let mut table = schema.table("events");
table.id("id");
table.json("payload").nullable();
table.partition_by_hash("id", Some(4))?;
assert_eq!(
    table.create()?.query,
    "CREATE TABLE `events` (`id` BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, `payload` JSON NULL, \
     PRIMARY KEY (`id`)) PARTITION BY HASH(id) PARTITIONS 4"
);
Also implements Debug.