/
schema.go
95 lines (91 loc) · 2.81 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Code generated by ent, DO NOT EDIT.
package migrate
import (
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/dialect/sql/schema"
"entgo.io/ent/schema/field"
)
var (
// LocationColumns holds the columns for the "location" table.
LocationColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "name", Type: field.TypeString, Size: 2048},
{Name: "description", Type: field.TypeString, Size: 2048},
{Name: "source", Type: field.TypeEnum, Enums: []string{"unspecified", "minio", "sftp"}},
{Name: "purpose", Type: field.TypeEnum, Enums: []string{"unspecified", "aip_store"}},
{Name: "uuid", Type: field.TypeUUID, Unique: true},
{Name: "config", Type: field.TypeJSON},
{Name: "created_at", Type: field.TypeTime},
}
// LocationTable holds the schema information for the "location" table.
LocationTable = &schema.Table{
Name: "location",
Columns: LocationColumns,
PrimaryKey: []*schema.Column{LocationColumns[0]},
Indexes: []*schema.Index{
{
Name: "location_name",
Unique: false,
Columns: []*schema.Column{LocationColumns[1]},
Annotation: &entsql.IndexAnnotation{
Prefix: 50,
},
},
{
Name: "location_uuid",
Unique: false,
Columns: []*schema.Column{LocationColumns[5]},
},
},
}
// PackageColumns holds the columns for the "package" table.
PackageColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "name", Type: field.TypeString, Size: 2048},
{Name: "aip_id", Type: field.TypeUUID, Unique: true},
{Name: "status", Type: field.TypeEnum, Enums: []string{"unspecified", "in_review", "rejected", "stored", "moving"}},
{Name: "object_key", Type: field.TypeUUID, Unique: true},
{Name: "created_at", Type: field.TypeTime},
{Name: "location_id", Type: field.TypeInt, Nullable: true},
}
// PackageTable holds the schema information for the "package" table.
PackageTable = &schema.Table{
Name: "package",
Columns: PackageColumns,
PrimaryKey: []*schema.Column{PackageColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "package_location_location",
Columns: []*schema.Column{PackageColumns[6]},
RefColumns: []*schema.Column{LocationColumns[0]},
OnDelete: schema.SetNull,
},
},
Indexes: []*schema.Index{
{
Name: "pkg_aip_id",
Unique: false,
Columns: []*schema.Column{PackageColumns[2]},
},
{
Name: "pkg_object_key",
Unique: false,
Columns: []*schema.Column{PackageColumns[4]},
},
},
}
// Tables holds all the tables in the schema.
Tables = []*schema.Table{
LocationTable,
PackageTable,
}
)
func init() {
LocationTable.Annotation = &entsql.Annotation{
Table: "location",
}
PackageTable.ForeignKeys[0].RefTable = LocationTable
PackageTable.Annotation = &entsql.Annotation{
Table: "package",
}
}