Няма описание
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sync_solution_sql.go 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package tables
  2. import (
  3. "time"
  4. "git.x2erp.com/qdy/go-db/sqldef"
  5. )
  6. func init() {
  7. sqldef.AddRegistration(func(r *sqldef.Registry) {
  8. tb := sqldef.NewTable("sync_solution_sql", "同步SQL代码表 - 存储数据仓库同步脚本").
  9. ID("id", 128).NotNull().Comment("主键").End().
  10. String("sync_id", 50).NotNull().Comment("同步代码").End().
  11. String("sync_name", 100).NotNull().Comment("同步名称").End().
  12. String("solution_id", 32).NotNull().Comment("方案代码").End().
  13. Text("code_sql").NotNull().Comment("SQL代码").End().
  14. Text("count_sql").NotNull().Comment("统计记录总SQL代码").End().
  15. TinyInt("is_active").NotNull().Default("1").Comment("是否启用: 1启用,0禁用").End().
  16. String("creator", 32).NotNull().Comment("创建人").End().
  17. DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End().
  18. DateTime("updated_at").NotNull().Default("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").Comment("更新时间").End().
  19. DateTime("deleted_at").Comment("删除时间").End()
  20. tb.AddIndex("idx_sync_id", "sync_id")
  21. tb.AddIndex("idx_solution_id", "solution_id")
  22. r.RegisterTable(tb.Build())
  23. })
  24. }
  25. type SyncSolutionSQL struct {
  26. SyncID string `gorm:"column:sync_id;type:varchar(50);not null;primaryKey;comment:同步代码"`
  27. SyncName string `gorm:"column:sync_name;type:varchar(100);not null;comment:同步名称"`
  28. SolutionID string `gorm:"column:solution_id;type:varchar(32);not null;comment:方案代码"`
  29. CodeSQL string `gorm:"column:code_sql;type:text;not null;comment:SQL代码"`
  30. CountSQL string `gorm:"column:count_sql;type:text;not null;comment:统计记录总SQL代码"`
  31. IsActive int8 `gorm:"column:is_active;type:tinyint;not null;default:1;comment:是否启用: 1启用,0禁用"`
  32. Creator string `gorm:"column:creator;type:varchar(32);not null;comment:创建人"`
  33. CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间"`
  34. UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;comment:更新时间"`
  35. DeletedAt *time.Time `gorm:"column:deleted_at;comment:删除时间"`
  36. }
  37. type SyncSolutionSQLDB struct {
  38. ID string `db:"id" json:"id"`
  39. SyncID string `db:"sync_id" json:"syncID"`
  40. SyncName string `db:"sync_name" json:"syncName"`
  41. SolutionID string `db:"solution_id" json:"solutionID"`
  42. CodeSQL string `db:"code_sql" json:"codeSQL"`
  43. CountSQL string `db:"count_sql" json:"countSQL"`
  44. IsActive int8 `db:"is_active" json:"isActive"`
  45. Creator string `db:"creator" json:"creator"`
  46. CreatedAt time.Time `db:"created_at" json:"createdAt"`
  47. UpdatedAt time.Time `db:"updated_at" json:"updatedAt"`
  48. DeletedAt *time.Time `db:"deleted_at" json:"deletedAt"`
  49. }
  50. func (SyncSolutionSQL) TableName() string {
  51. return "sync_solution_sql"
  52. }