Files
muninn-aio/ent/migrate/schema.go

78 lines
2.2 KiB
Go

// Code generated by ent, DO NOT EDIT.
package migrate
import (
"entgo.io/ent/dialect/sql/schema"
"entgo.io/ent/schema/field"
)
var (
// LinksColumns holds the columns for the "links" table.
LinksColumns = []*schema.Column{
{Name: "id", Type: field.TypeUUID, Unique: true},
{Name: "key", Type: field.TypeString, Unique: true},
{Name: "original_url", Type: field.TypeString},
}
// LinksTable holds the schema information for the "links" table.
LinksTable = &schema.Table{
Name: "links",
Columns: LinksColumns,
PrimaryKey: []*schema.Column{LinksColumns[0]},
Indexes: []*schema.Index{
{
Name: "link_key",
Unique: true,
Columns: []*schema.Column{LinksColumns[1]},
},
},
}
// UsersColumns holds the columns for the "users" table.
UsersColumns = []*schema.Column{
{Name: "id", Type: field.TypeUUID, Unique: true},
{Name: "telegram_id", Type: field.TypeInt64, Unique: true},
}
// UsersTable holds the schema information for the "users" table.
UsersTable = &schema.Table{
Name: "users",
Columns: UsersColumns,
PrimaryKey: []*schema.Column{UsersColumns[0]},
}
// UserLinksColumns holds the columns for the "user_links" table.
UserLinksColumns = []*schema.Column{
{Name: "user_id", Type: field.TypeUUID},
{Name: "link_id", Type: field.TypeUUID},
}
// UserLinksTable holds the schema information for the "user_links" table.
UserLinksTable = &schema.Table{
Name: "user_links",
Columns: UserLinksColumns,
PrimaryKey: []*schema.Column{UserLinksColumns[0], UserLinksColumns[1]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "user_links_user_id",
Columns: []*schema.Column{UserLinksColumns[0]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.Cascade,
},
{
Symbol: "user_links_link_id",
Columns: []*schema.Column{UserLinksColumns[1]},
RefColumns: []*schema.Column{LinksColumns[0]},
OnDelete: schema.Cascade,
},
},
}
// Tables holds all the tables in the schema.
Tables = []*schema.Table{
LinksTable,
UsersTable,
UserLinksTable,
}
)
func init() {
UserLinksTable.ForeignKeys[0].RefTable = UsersTable
UserLinksTable.ForeignKeys[1].RefTable = LinksTable
}