-
-
Notifications
You must be signed in to change notification settings - Fork 50
feat: add an actual is_active field in the DatabaseUser #578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| //! Generated by cot CLI 0.1.0 on 2026-05-21 12:00:00+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_0002_add_is_active"; | ||
| const DEPENDENCIES: &'static [::cot::db::migrations::MigrationDependency] = | ||
| &[::cot::db::migrations::MigrationDependency::migration( | ||
| "cot", | ||
| "m_0001_initial", | ||
| )]; | ||
| const OPERATIONS: &'static [::cot::db::migrations::Operation] = | ||
| &[::cot::db::migrations::Operation::add_field() | ||
| .table_name(::cot::db::Identifier::new("cot__database_user")) | ||
| .field( | ||
| ::cot::db::migrations::Field::new( | ||
| ::cot::db::Identifier::new("is_active"), | ||
| <bool as ::cot::db::DatabaseField>::TYPE, | ||
| ) | ||
| .set_null(<bool as ::cot::db::DatabaseField>::NULLABLE), | ||
| ) | ||
| .build()]; | ||
|
Comment on lines
+14
to
+23
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, should we add support for specifying custom default value? 🤔
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, we definitely should support that
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh, this is actually an edge case in our migration generator that we should definitely handle. I think we should therefore wait with merging this until we have a support for this. |
||
| } | ||
|
|
||
| #[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, | ||
| is_active: bool, | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.