deepaksinghvi / cdule

cdule (pronounce as Schedule) Golang based scheduler library with database support.
MIT License
54 stars 10 forks source link

Issue with creating job_histories table due to duplicate column name. #6

Open mmanda-extr opened 1 year ago

mmanda-extr commented 1 year ago

Hello @deepaksinghvi, There is an issue with creation of job_histories table during initial bringup.

Both JobHistory struct and its embedded Model struct have a field named Deleted at and this is causing table creation error with duplicate column names with the following error:

During compilation of cdule/pkg/model/setup.go:117 Error 1060: Duplicate column name 'deleted_at' [57.116ms] [rows:0] CREATE TABLE job_histories (id bigint AUTO_INCREMENT,created_at datetime(3) NULL,updated_at datetime(3) NULL,deleted_at datetime(3) NULL,job_id bigint,execution_id bigint,status longtext,worker_id longtext,retry_count bigint,PRIMARY KEY (id),INDEX idx_job_histories_deleted_at (deleted_at,deleted_at))

I see that DeletedAt in Model structure is not used. Either this can be commented out or a different column name using the following gorm attribute can be added:

DeletedAt gorm.DeletedAt gorm:"column:model_deleted_at; index"

Please let me know what you think.