cot 0.5.0

The Rust web framework for lazy developers.
Documentation
//! Generated by cot CLI 0.1.0 on 2025-02-13 10:29:03+00:00

#[derive(Debug, Copy, Clone)]
pub(super) struct Migration;
impl ::cot::db::migrations::Migration for Migration {
    const APP_NAME: &'static str = "cot";
    const MIGRATION_NAME: &'static str = "m_0001_initial";
    const DEPENDENCIES: &'static [::cot::db::migrations::MigrationDependency] = &[];
    const OPERATIONS: &'static [::cot::db::migrations::Operation] = &[
        ::cot::db::migrations::Operation::create_model()
            .table_name(::cot::db::Identifier::new("cot__database_user"))
            .fields(
                &[
                    ::cot::db::migrations::Field::new(
                            ::cot::db::Identifier::new("id"),
                            <cot::db::Auto<i64> as ::cot::db::DatabaseField>::TYPE,
                        )
                        .auto()
                        .primary_key()
                        .set_null(
                            <cot::db::Auto<i64> as ::cot::db::DatabaseField>::NULLABLE,
                        ),
                    ::cot::db::migrations::Field::new(
                            ::cot::db::Identifier::new("username"),
                            <crate::db::LimitedString<
                                { crate::auth::db::MAX_USERNAME_LENGTH },
                            > as ::cot::db::DatabaseField>::TYPE,
                        )
                        .set_null(
                            <crate::db::LimitedString<
                                { crate::auth::db::MAX_USERNAME_LENGTH },
                            > as ::cot::db::DatabaseField>::NULLABLE,
                        )
                        .unique(),
                    ::cot::db::migrations::Field::new(
                            ::cot::db::Identifier::new("password"),
                            <crate::auth::PasswordHash as ::cot::db::DatabaseField>::TYPE,
                        )
                        .set_null(
                            <crate::auth::PasswordHash as ::cot::db::DatabaseField>::NULLABLE,
                        ),
                ],
            )
            .build(),
    ];
}

#[derive(::core::fmt::Debug)]
#[::cot::db::model(model_type = "migration")]
struct _DatabaseUser {
    #[model(primary_key)]
    id: cot::db::Auto<i64>,
    #[model(unique)]
    username: crate::db::LimitedString<{ crate::auth::db::MAX_USERNAME_LENGTH }>,
    password: crate::auth::PasswordHash,
}