shindo_coding_utils 0.4.4

A utils crates which will be used in various micro-services
Documentation
use chrono::{DateTime, Utc, NaiveDate};
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "experiment")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub id: i64,

    pub ticker: String,

    pub experiment_type: String,

    #[sea_orm(column_type = "Text")]
    pub json_string: String,

    pub reviewed: bool,

    pub created_at: DateTime<Utc>,
    pub date: NaiveDate,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}

impl ActiveModelBehavior for ActiveModel {}

// CREATE TABLE `experiment` (
//     `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
//     `ticker` VARCHAR(255) NOT NULL,
//     `json_string` LONGTEXT NOT NULL,
//     `reviewed` BOOLEAN NOT NULL,
//     `created_at` DATETIME(3) NOT NULL
// ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

// CREATE INDEX `idx_experiment_ticker` ON `experiment` (`ticker`);

// ALTER TABLE experiment ADD COLUMN date DATE NOT NULL DEFAULT '1970-01-01';
// UPDATE experiment SET date = DATE(created_at);
// ALTER TABLE experiment ADD CONSTRAINT unique_ticker_date UNIQUE (ticker, date);

// ALTER TABLE experiment ADD COLUMN experiment_Type VARCHAR(100) DEFAULT NULL;
// UPDATE experiment SET experiment_type = 'find_trading_pattern';
// ALTER TABLE experiment ADD CONSTRAINT unique_ticker_date_experiment_type UNIQUE (ticker, date, experiment_type);