forked from ogen-go/ent2ogen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.go
76 lines (72 loc) · 2.6 KB
/
schema.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Code generated by ent, DO NOT EDIT.
package migrate
import (
"entgo.io/ent/dialect/sql/schema"
"entgo.io/ent/schema/field"
)
var (
// KeyboardsColumns holds the columns for the "keyboards" table.
KeyboardsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
{Name: "name", Type: field.TypeString},
{Name: "price", Type: field.TypeInt64},
{Name: "discount", Type: field.TypeInt64, Nullable: true},
{Name: "keyboard_switches", Type: field.TypeInt64},
{Name: "keyboard_keycaps", Type: field.TypeInt64},
}
// KeyboardsTable holds the schema information for the "keyboards" table.
KeyboardsTable = &schema.Table{
Name: "keyboards",
Columns: KeyboardsColumns,
PrimaryKey: []*schema.Column{KeyboardsColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "keyboards_switch_models_switches",
Columns: []*schema.Column{KeyboardsColumns[4]},
RefColumns: []*schema.Column{SwitchModelsColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "keyboards_keycap_models_keycaps",
Columns: []*schema.Column{KeyboardsColumns[5]},
RefColumns: []*schema.Column{KeycapModelsColumns[0]},
OnDelete: schema.NoAction,
},
},
}
// KeycapModelsColumns holds the columns for the "keycap_models" table.
KeycapModelsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
{Name: "name", Type: field.TypeString},
{Name: "profile", Type: field.TypeString},
{Name: "material", Type: field.TypeEnum, Enums: []string{"ABS", "PBT"}},
}
// KeycapModelsTable holds the schema information for the "keycap_models" table.
KeycapModelsTable = &schema.Table{
Name: "keycap_models",
Columns: KeycapModelsColumns,
PrimaryKey: []*schema.Column{KeycapModelsColumns[0]},
}
// SwitchModelsColumns holds the columns for the "switch_models" table.
SwitchModelsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
{Name: "name", Type: field.TypeString},
{Name: "switch_type", Type: field.TypeEnum, Enums: []string{"mechanical", "optical", "electrocapacitive"}},
}
// SwitchModelsTable holds the schema information for the "switch_models" table.
SwitchModelsTable = &schema.Table{
Name: "switch_models",
Columns: SwitchModelsColumns,
PrimaryKey: []*schema.Column{SwitchModelsColumns[0]},
}
// Tables holds all the tables in the schema.
Tables = []*schema.Table{
KeyboardsTable,
KeycapModelsTable,
SwitchModelsTable,
}
)
func init() {
KeyboardsTable.ForeignKeys[0].RefTable = SwitchModelsTable
KeyboardsTable.ForeignKeys[1].RefTable = KeycapModelsTable
}