(toggl-portal): Database work

This commit is contained in:
2023-11-02 16:00:55 +00:00
parent 8f39bf7d23
commit d47174efee
7 changed files with 63 additions and 11 deletions
+7 -3
View File
@@ -7,8 +7,12 @@ pub struct Migrator;
#[async_trait::async_trait]
impl MigratorTrait for Migrator {
fn migrations() -> Vec<Box<dyn MigrationTrait>> {
vec![
Box::new(m20231101_172500_create_time_entry_table::Migration),
]
vec![Box::new(
m20231101_172500_create_time_entry_table::Migration,
)]
}
fn migration_table_name() -> DynIden {
Alias::new("toggl_portal_seaql_migrations").into_iden()
}
}
@@ -13,15 +13,17 @@ impl MigrationTrait for Migration {
.if_not_exists()
.col(
ColumnDef::new(TimeEntry::Id)
.big_integer()
.integer()
.not_null()
.auto_increment()
.primary_key(),
)
.col(
ColumnDef::new(TimeEntry::TogglId).big_unsigned().not_null().unique_key())
.col(ColumnDef::new(TimeEntry::Description).string().not_null())
.col(ColumnDef::new(TimeEntry::ProjectId).big_integer())
.col(ColumnDef::new(TimeEntry::Start).timestamp().not_null())
.col(ColumnDef::new(TimeEntry::Stop).timestamp().not_null())
.col(ColumnDef::new(TimeEntry::ProjectId).big_unsigned())
.col(ColumnDef::new(TimeEntry::Start).timestamp_with_time_zone().not_null())
.col(ColumnDef::new(TimeEntry::Stop).timestamp_with_time_zone().not_null())
.col(ColumnDef::new(TimeEntry::RawJson).json_binary().not_null())
.to_owned(),
)
@@ -39,6 +41,7 @@ impl MigrationTrait for Migration {
enum TimeEntry {
Table,
Id,
TogglId,
Description,
ProjectId,
Start,