schema.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Code generated by entc, DO NOT EDIT.
  2. package migrate
  3. import (
  4. "entgo.io/ent/dialect/sql/schema"
  5. "entgo.io/ent/schema/field"
  6. )
  7. var (
  8. // TodosColumns holds the columns for the "todos" table.
  9. TodosColumns = []*schema.Column{
  10. {Name: "id", Type: field.TypeInt, Increment: true},
  11. {Name: "text", Type: field.TypeString, Size: 2147483647},
  12. {Name: "created_at", Type: field.TypeTime},
  13. {Name: "status", Type: field.TypeEnum, Enums: []string{"in_progress", "completed"}, Default: "in_progress"},
  14. {Name: "priority", Type: field.TypeInt, Default: 0},
  15. {Name: "todo_parent", Type: field.TypeInt, Nullable: true},
  16. }
  17. // TodosTable holds the schema information for the "todos" table.
  18. TodosTable = &schema.Table{
  19. Name: "todos",
  20. Columns: TodosColumns,
  21. PrimaryKey: []*schema.Column{TodosColumns[0]},
  22. ForeignKeys: []*schema.ForeignKey{
  23. {
  24. Symbol: "todos_todos_parent",
  25. Columns: []*schema.Column{TodosColumns[5]},
  26. RefColumns: []*schema.Column{TodosColumns[0]},
  27. OnDelete: schema.SetNull,
  28. },
  29. },
  30. }
  31. // Tables holds all the tables in the schema.
  32. Tables = []*schema.Table{
  33. TodosTable,
  34. }
  35. )
  36. func init() {
  37. TodosTable.ForeignKeys[0].RefTable = TodosTable
  38. }