telegram-commerce/ent/migrate/schema.go

143 lines
5.9 KiB
Go
Raw Normal View History

2023-10-25 21:54:32 +00:00
// Code generated by ent, DO NOT EDIT.
package migrate
import (
"entgo.io/ent/dialect/sql/schema"
"entgo.io/ent/schema/field"
)
var (
// BusinessesColumns holds the columns for the "businesses" table.
BusinessesColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "name", Type: field.TypeString, Default: "unknown"},
{Name: "slug", Type: field.TypeString, Unique: true},
{Name: "bot_id", Type: field.TypeString, Unique: true},
{Name: "description", Type: field.TypeString, Nullable: true},
{Name: "company", Type: field.TypeString, Default: "main"},
{Name: "about_us", Type: field.TypeString, Nullable: true},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime},
}
// BusinessesTable holds the schema information for the "businesses" table.
BusinessesTable = &schema.Table{
Name: "businesses",
Columns: BusinessesColumns,
PrimaryKey: []*schema.Column{BusinessesColumns[0]},
}
// BusinessCategoriesColumns holds the columns for the "business_categories" table.
BusinessCategoriesColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "slug", Type: field.TypeString, Unique: true},
{Name: "name", Type: field.TypeString, Default: "unknown"},
{Name: "description", Type: field.TypeString, Default: "unknown"},
}
// BusinessCategoriesTable holds the schema information for the "business_categories" table.
BusinessCategoriesTable = &schema.Table{
Name: "business_categories",
Columns: BusinessCategoriesColumns,
PrimaryKey: []*schema.Column{BusinessCategoriesColumns[0]},
}
// ProductsColumns holds the columns for the "products" table.
ProductsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "name", Type: field.TypeString, Default: "unknown"},
{Name: "description", Type: field.TypeString, Nullable: true},
{Name: "price", Type: field.TypeFloat64, Default: 0},
{Name: "original_price", Type: field.TypeFloat64, Default: 0},
{Name: "quantity", Type: field.TypeInt, Default: 0},
{Name: "status", Type: field.TypeBool, Default: true},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime},
}
// ProductsTable holds the schema information for the "products" table.
ProductsTable = &schema.Table{
Name: "products",
Columns: ProductsColumns,
PrimaryKey: []*schema.Column{ProductsColumns[0]},
}
// ProductCategoriesColumns holds the columns for the "product_categories" table.
ProductCategoriesColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "name", Type: field.TypeString, Default: "unknown"},
{Name: "slug", Type: field.TypeString, Unique: true},
{Name: "description", Type: field.TypeString, Nullable: true},
{Name: "status", Type: field.TypeBool, Default: true},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime},
}
// ProductCategoriesTable holds the schema information for the "product_categories" table.
ProductCategoriesTable = &schema.Table{
Name: "product_categories",
Columns: ProductCategoriesColumns,
PrimaryKey: []*schema.Column{ProductCategoriesColumns[0]},
}
// BusinessCategoryBusinessesColumns holds the columns for the "business_category_businesses" table.
BusinessCategoryBusinessesColumns = []*schema.Column{
{Name: "business_category_id", Type: field.TypeInt},
{Name: "business_id", Type: field.TypeInt},
}
// BusinessCategoryBusinessesTable holds the schema information for the "business_category_businesses" table.
BusinessCategoryBusinessesTable = &schema.Table{
Name: "business_category_businesses",
Columns: BusinessCategoryBusinessesColumns,
PrimaryKey: []*schema.Column{BusinessCategoryBusinessesColumns[0], BusinessCategoryBusinessesColumns[1]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "business_category_businesses_business_category_id",
Columns: []*schema.Column{BusinessCategoryBusinessesColumns[0]},
RefColumns: []*schema.Column{BusinessCategoriesColumns[0]},
OnDelete: schema.Cascade,
},
{
Symbol: "business_category_businesses_business_id",
Columns: []*schema.Column{BusinessCategoryBusinessesColumns[1]},
RefColumns: []*schema.Column{BusinessesColumns[0]},
OnDelete: schema.Cascade,
},
},
}
// ProductCategoryProductsColumns holds the columns for the "product_category_products" table.
ProductCategoryProductsColumns = []*schema.Column{
{Name: "product_category_id", Type: field.TypeInt},
{Name: "product_id", Type: field.TypeInt},
}
// ProductCategoryProductsTable holds the schema information for the "product_category_products" table.
ProductCategoryProductsTable = &schema.Table{
Name: "product_category_products",
Columns: ProductCategoryProductsColumns,
PrimaryKey: []*schema.Column{ProductCategoryProductsColumns[0], ProductCategoryProductsColumns[1]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "product_category_products_product_category_id",
Columns: []*schema.Column{ProductCategoryProductsColumns[0]},
RefColumns: []*schema.Column{ProductCategoriesColumns[0]},
OnDelete: schema.Cascade,
},
{
Symbol: "product_category_products_product_id",
Columns: []*schema.Column{ProductCategoryProductsColumns[1]},
RefColumns: []*schema.Column{ProductsColumns[0]},
OnDelete: schema.Cascade,
},
},
}
// Tables holds all the tables in the schema.
Tables = []*schema.Table{
BusinessesTable,
BusinessCategoriesTable,
ProductsTable,
ProductCategoriesTable,
BusinessCategoryBusinessesTable,
ProductCategoryProductsTable,
}
)
func init() {
BusinessCategoryBusinessesTable.ForeignKeys[0].RefTable = BusinessCategoriesTable
BusinessCategoryBusinessesTable.ForeignKeys[1].RefTable = BusinessesTable
ProductCategoryProductsTable.ForeignKeys[0].RefTable = ProductCategoriesTable
ProductCategoryProductsTable.ForeignKeys[1].RefTable = ProductsTable
}