database
ModuleDatabases, tables, columns, indexes and rows.
Contents
2 submodules, and what the module defines itself.
use utopia_migration::resources::database::Database;pub struct DatabaseA database.
use utopia_migration::resources::database::Field;pub struct FieldA column (or attribute) of a table.
use utopia_migration::resources::database::FieldSpec;pub struct FieldSpecArguments common to every column constructor.
use utopia_migration::resources::database::Index;pub struct IndexAn index of a table.
use utopia_migration::resources::database::Row;pub struct RowA row of a table (or a document of a collection).
use utopia_migration::resources::database::Table;pub struct TableA table, or a collection of a DocumentsDB or VectorsDB database.
use utopia_migration::resources::database::DatabaseFlavor;pub enum DatabaseFlavorWhich database class a database resource is.
use utopia_migration::resources::database::FieldClass;pub enum FieldClassThe class of a column (or an attribute derived from one).
use utopia_migration::resources::database::resolve;pub fn resolve(definition: &Array) -> (String, String, i64)A column definition resolved to the type, format and size Appwrite stores: a format shorthand becomes a string of that format, a missing size comes from the type or the format.
pub const LENGTH_KEY: i64 = 255Undocumented.
database::column
Own pagepub const BIG_INT: &str = "bigint"A big integer.
pub const BOOLEAN: &str = "boolean"A boolean.
pub const DATETIME: &str = "datetime"A datetime.
pub const DEFAULT_VARCHAR_SIZE: i64 = 255The size of a varchar given none (Column::DEFAULT_VARCHAR_SIZE).
pub const EMAIL: &str = "email"An email string.
pub const ENUM: &str = "enum"An enum string.
pub const FLOAT: &str = "double"A float.
pub const FORMAT_SIZES: &[(&str, i64)] = &[(EMAIL, 254), (ENUM, super::LENGTH_KEY), (IP, 39), (URL, 2000)]Format shorthands and their sizes (Column::FORMAT_SIZES).
pub const INTEGER: &str = "integer"An integer.
pub const IP: &str = "ip"An IP string.
pub const LINE: &str = "linestring"A line.
pub const LONGTEXT: &str = "longtext"A LONGTEXT string.
pub const MEDIUMTEXT: &str = "mediumtext"A MEDIUMTEXT string.
pub const OBJECT: &str = "object"An object.
pub const POINT: &str = "point"A point.
pub const POLYGON: &str = "polygon"A polygon.
pub const RELATIONSHIP: &str = "relationship"A relationship.
pub const SIZES: &[(&str, i64)] = &[(TEXT, 65535), (MEDIUMTEXT, 16_777_215), (LONGTEXT, 2_147_483_647)]Sizes fixed by the type (Column::SIZES).
pub const STRING: &str = "string"A string.
pub const TEXT: &str = "text"A TEXT string.
pub const URL: &str = "url"A URL string.
pub const VARCHAR: &str = "varchar"A VARCHAR string.
pub const VECTOR: &str = "vector"A vector.
database::columns
Own pageBuilders of each column class with its constructor's defaults.
use utopia_migration::resources::database::columns::boolean;pub fn boolean(key: &str, table: ResourceRef, required: bool, default: Option<bool>, array: bool) -> FieldA Boolean column.
use utopia_migration::resources::database::columns::datetime;pub fn datetime(key: &str, table: ResourceRef, required: bool, default: Option<String>, array: bool) -> FieldA DateTime column (with the datetime filter).
use utopia_migration::resources::database::columns::decimal;pub fn decimal(key: &str, table: ResourceRef, required: bool, default: Option<f64>, array: bool, min: Option<f64>, max: Option<f64>, signed: bool) -> FieldUndocumented.
use utopia_migration::resources::database::columns::default_size;pub fn default_size(class: FieldClass) -> i64The default size of a string class (Text: LENGTH_KEY, Email: 254, ...).
use utopia_migration::resources::database::columns::enumeration;pub fn enumeration(key: &str, table: ResourceRef, elements: Array, required: bool, default: Option<String>, array: bool, size: i64) -> FieldAn Enum column.
use utopia_migration::resources::database::columns::from_array;pub fn from_array(class: FieldClass, array: &Array) -> Result<ResourceRef>Of column class class. Email, IP
and URL inherit Text::fromArray(), which builds a Text (it calls
new self), so they return Text columns.
use utopia_migration::resources::database::columns::integer;pub fn integer(big: bool, key: &str, table: ResourceRef, required: bool, default: Option<i64>, array: bool, min: Option<i64>, max: Option<i64>, signed: bool) -> FieldAn Integer (big: false) or BigInt column.
use utopia_migration::resources::database::columns::relationship;pub fn relationship(key: &str, table: ResourceRef, related_table: &str, relation_type: &str, two_way: bool, two_way_key: Option<String>, on_delete: &str, side: &str) -> FieldA Relationship column.
use utopia_migration::resources::database::columns::structured;pub fn structured(class: FieldClass, key: &str, table: ResourceRef, required: bool, default: Option<Array>) -> FieldA Point, Line, Polygon or ObjectType column.
use utopia_migration::resources::database::columns::text;pub fn text(class: FieldClass, key: &str, table: ResourceRef, required: bool, default: Option<String>, array: bool, size: i64, format: &str) -> FieldA string column of class class (Text, Email, IP, URL, RegularText,
MediumText, LongText, Varchar, Enum without elements).
use utopia_migration::resources::database::columns::vector;pub fn vector(key: &str, table: ResourceRef, required: bool, size: i64, default: Option<Array>) -> FieldA Vector column.