/
schema.go
64 lines (60 loc) · 2.15 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
// Code generated by entc, DO NOT EDIT.
package migrate
import (
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/dialect/sql/schema"
"entgo.io/ent/schema/field"
)
var (
// BlogContentColumns holds the columns for the "blog_content" table.
BlogContentColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt32, Increment: true},
{Name: "content", Type: field.TypeString, SchemaType: map[string]string{"mysql": "text"}},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
}
// BlogContentTable holds the schema information for the "blog_content" table.
BlogContentTable = &schema.Table{
Name: "blog_content",
Columns: BlogContentColumns,
PrimaryKey: []*schema.Column{BlogContentColumns[0]},
}
// BlogIndexColumns holds the columns for the "blog_index" table.
BlogIndexColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt32, Increment: true},
{Name: "content_id", Type: field.TypeInt32, Unique: true},
{Name: "title", Type: field.TypeString, Size: 100},
{Name: "desc", Type: field.TypeString},
{Name: "attr", Type: field.TypeInt32, Default: 0},
{Name: "view", Type: field.TypeInt32, Default: 0},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "state", Type: field.TypeInt8, Default: 1},
}
// BlogIndexTable holds the schema information for the "blog_index" table.
BlogIndexTable = &schema.Table{
Name: "blog_index",
Columns: BlogIndexColumns,
PrimaryKey: []*schema.Column{BlogIndexColumns[0]},
Indexes: []*schema.Index{
{
Name: "index_content_id",
Unique: true,
Columns: []*schema.Column{BlogIndexColumns[1]},
},
},
}
// Tables holds all the tables in the schema.
Tables = []*schema.Table{
BlogContentTable,
BlogIndexTable,
}
)
func init() {
BlogContentTable.Annotation = &entsql.Annotation{
Table: "blog_content",
}
BlogIndexTable.Annotation = &entsql.Annotation{
Table: "blog_index",
}
}