84 lines
2.9 KiB
Go
84 lines
2.9 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package migrate
|
|
|
|
import (
|
|
"entgo.io/ent/dialect/sql/schema"
|
|
"entgo.io/ent/schema/field"
|
|
)
|
|
|
|
var (
|
|
// CategoriesColumns holds the columns for the "categories" table.
|
|
CategoriesColumns = []*schema.Column{
|
|
{Name: "id", Type: field.TypeUUID, Unique: true},
|
|
{Name: "created_at", Type: field.TypeTime},
|
|
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
|
|
{Name: "title", Type: field.TypeString},
|
|
{Name: "description", Type: field.TypeString, Nullable: true, Size: 2147483647},
|
|
}
|
|
// CategoriesTable holds the schema information for the "categories" table.
|
|
CategoriesTable = &schema.Table{
|
|
Name: "categories",
|
|
Columns: CategoriesColumns,
|
|
PrimaryKey: []*schema.Column{CategoriesColumns[0]},
|
|
}
|
|
// PostsColumns holds the columns for the "posts" table.
|
|
PostsColumns = []*schema.Column{
|
|
{Name: "id", Type: field.TypeUUID, Unique: true},
|
|
{Name: "created_at", Type: field.TypeTime},
|
|
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
|
|
{Name: "expires", Type: field.TypeBool, Default: false},
|
|
{Name: "expire_time", Type: field.TypeTime, Nullable: true},
|
|
{Name: "title", Type: field.TypeString},
|
|
{Name: "body", Type: field.TypeString, Size: 2147483647},
|
|
{Name: "category_posts", Type: field.TypeUUID, Nullable: true},
|
|
{Name: "profile_posts", Type: field.TypeUUID, Nullable: true},
|
|
}
|
|
// PostsTable holds the schema information for the "posts" table.
|
|
PostsTable = &schema.Table{
|
|
Name: "posts",
|
|
Columns: PostsColumns,
|
|
PrimaryKey: []*schema.Column{PostsColumns[0]},
|
|
ForeignKeys: []*schema.ForeignKey{
|
|
{
|
|
Symbol: "posts_categories_posts",
|
|
Columns: []*schema.Column{PostsColumns[7]},
|
|
RefColumns: []*schema.Column{CategoriesColumns[0]},
|
|
OnDelete: schema.SetNull,
|
|
},
|
|
{
|
|
Symbol: "posts_profiles_posts",
|
|
Columns: []*schema.Column{PostsColumns[8]},
|
|
RefColumns: []*schema.Column{ProfilesColumns[0]},
|
|
OnDelete: schema.SetNull,
|
|
},
|
|
},
|
|
}
|
|
// ProfilesColumns holds the columns for the "profiles" table.
|
|
ProfilesColumns = []*schema.Column{
|
|
{Name: "id", Type: field.TypeUUID, Unique: true},
|
|
{Name: "created_at", Type: field.TypeTime},
|
|
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
|
|
{Name: "name", Type: field.TypeString, Nullable: true},
|
|
{Name: "address", Type: field.TypeString, Nullable: true, Size: 2147483647},
|
|
{Name: "phone", Type: field.TypeString, Nullable: true},
|
|
}
|
|
// ProfilesTable holds the schema information for the "profiles" table.
|
|
ProfilesTable = &schema.Table{
|
|
Name: "profiles",
|
|
Columns: ProfilesColumns,
|
|
PrimaryKey: []*schema.Column{ProfilesColumns[0]},
|
|
}
|
|
// Tables holds all the tables in the schema.
|
|
Tables = []*schema.Table{
|
|
CategoriesTable,
|
|
PostsTable,
|
|
ProfilesTable,
|
|
}
|
|
)
|
|
|
|
func init() {
|
|
PostsTable.ForeignKeys[0].RefTable = CategoriesTable
|
|
PostsTable.ForeignKeys[1].RefTable = ProfilesTable
|
|
}
|