rag/ent/migrate/schema.go
2024-07-21 17:24:43 +08:00

97 lines
3.0 KiB
Go

// Code generated by ent, DO NOT EDIT.
package migrate
import (
"entgo.io/ent/dialect/sql/schema"
"entgo.io/ent/schema/field"
)
var (
// DocumentsColumns holds the columns for the "documents" table.
DocumentsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "name", Type: field.TypeString},
{Name: "user_id", Type: field.TypeString},
{Name: "library_id", Type: field.TypeInt64},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime},
{Name: "document_block_document", Type: field.TypeInt, Nullable: true},
}
// DocumentsTable holds the schema information for the "documents" table.
DocumentsTable = &schema.Table{
Name: "documents",
Columns: DocumentsColumns,
PrimaryKey: []*schema.Column{DocumentsColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "documents_document_blocks_document",
Columns: []*schema.Column{DocumentsColumns[6]},
RefColumns: []*schema.Column{DocumentBlocksColumns[0]},
OnDelete: schema.SetNull,
},
},
Indexes: []*schema.Index{
{
Name: "document_name_user_id",
Unique: false,
Columns: []*schema.Column{DocumentsColumns[1], DocumentsColumns[2]},
},
},
}
// DocumentBlocksColumns holds the columns for the "document_blocks" table.
DocumentBlocksColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "content", Type: field.TypeString},
{Name: "order", Type: field.TypeInt64},
{Name: "document_id", Type: field.TypeInt64},
{Name: "user_id", Type: field.TypeString},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime},
}
// DocumentBlocksTable holds the schema information for the "document_blocks" table.
DocumentBlocksTable = &schema.Table{
Name: "document_blocks",
Columns: DocumentBlocksColumns,
PrimaryKey: []*schema.Column{DocumentBlocksColumns[0]},
Indexes: []*schema.Index{
{
Name: "documentblock_user_id_order",
Unique: false,
Columns: []*schema.Column{DocumentBlocksColumns[4], DocumentBlocksColumns[2]},
},
},
}
// LibrariesColumns holds the columns for the "libraries" table.
LibrariesColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "name", Type: field.TypeString},
{Name: "user_id", Type: field.TypeString},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime},
}
// LibrariesTable holds the schema information for the "libraries" table.
LibrariesTable = &schema.Table{
Name: "libraries",
Columns: LibrariesColumns,
PrimaryKey: []*schema.Column{LibrariesColumns[0]},
Indexes: []*schema.Index{
{
Name: "library_name_user_id",
Unique: false,
Columns: []*schema.Column{LibrariesColumns[1], LibrariesColumns[2]},
},
},
}
// Tables holds all the tables in the schema.
Tables = []*schema.Table{
DocumentsTable,
DocumentBlocksTable,
LibrariesTable,
}
)
func init() {
DocumentsTable.ForeignKeys[0].RefTable = DocumentBlocksTable
}