versia-go/ent/migrate/schema.go
2024-08-13 01:18:14 +02:00

266 lines
9.8 KiB
Go

// Code generated by ent, DO NOT EDIT.
package migrate
import (
"entgo.io/ent/dialect/sql/schema"
"entgo.io/ent/schema/field"
)
var (
// AttachmentsColumns holds the columns for the "attachments" table.
AttachmentsColumns = []*schema.Column{
{Name: "id", Type: field.TypeUUID},
{Name: "is_remote", Type: field.TypeBool},
{Name: "uri", Type: field.TypeString},
{Name: "extensions", Type: field.TypeJSON},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime},
{Name: "description", Type: field.TypeString, Size: 384},
{Name: "sha256", Type: field.TypeBytes},
{Name: "size", Type: field.TypeInt},
{Name: "blurhash", Type: field.TypeString, Nullable: true},
{Name: "height", Type: field.TypeInt, Nullable: true},
{Name: "width", Type: field.TypeInt, Nullable: true},
{Name: "fps", Type: field.TypeInt, Nullable: true},
{Name: "mime_type", Type: field.TypeString},
{Name: "attachment_author", Type: field.TypeUUID},
{Name: "note_attachments", Type: field.TypeUUID, Nullable: true},
}
// AttachmentsTable holds the schema information for the "attachments" table.
AttachmentsTable = &schema.Table{
Name: "attachments",
Columns: AttachmentsColumns,
PrimaryKey: []*schema.Column{AttachmentsColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "attachments_users_author",
Columns: []*schema.Column{AttachmentsColumns[14]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "attachments_notes_attachments",
Columns: []*schema.Column{AttachmentsColumns[15]},
RefColumns: []*schema.Column{NotesColumns[0]},
OnDelete: schema.SetNull,
},
},
}
// FollowsColumns holds the columns for the "follows" table.
FollowsColumns = []*schema.Column{
{Name: "id", Type: field.TypeUUID},
{Name: "is_remote", Type: field.TypeBool},
{Name: "uri", Type: field.TypeString},
{Name: "extensions", Type: field.TypeJSON},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime},
{Name: "status", Type: field.TypeEnum, Enums: []string{"pending", "accepted"}, Default: "pending"},
{Name: "follow_follower", Type: field.TypeUUID},
{Name: "follow_followee", Type: field.TypeUUID},
}
// FollowsTable holds the schema information for the "follows" table.
FollowsTable = &schema.Table{
Name: "follows",
Columns: FollowsColumns,
PrimaryKey: []*schema.Column{FollowsColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "follows_users_follower",
Columns: []*schema.Column{FollowsColumns[7]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "follows_users_followee",
Columns: []*schema.Column{FollowsColumns[8]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
},
Indexes: []*schema.Index{
{
Name: "follow_follow_follower_follow_followee",
Unique: true,
Columns: []*schema.Column{FollowsColumns[7], FollowsColumns[8]},
},
},
}
// ImagesColumns holds the columns for the "images" table.
ImagesColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "url", Type: field.TypeString},
{Name: "mime_type", Type: field.TypeString},
}
// ImagesTable holds the schema information for the "images" table.
ImagesTable = &schema.Table{
Name: "images",
Columns: ImagesColumns,
PrimaryKey: []*schema.Column{ImagesColumns[0]},
}
// NotesColumns holds the columns for the "notes" table.
NotesColumns = []*schema.Column{
{Name: "id", Type: field.TypeUUID},
{Name: "is_remote", Type: field.TypeBool},
{Name: "uri", Type: field.TypeString},
{Name: "extensions", Type: field.TypeJSON},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime},
{Name: "subject", Type: field.TypeString, Nullable: true, Size: 384},
{Name: "content", Type: field.TypeString},
{Name: "is_sensitive", Type: field.TypeBool, Default: false},
{Name: "visibility", Type: field.TypeEnum, Enums: []string{"public", "unlisted", "followers", "direct"}, Default: "public"},
{Name: "note_author", Type: field.TypeUUID},
}
// NotesTable holds the schema information for the "notes" table.
NotesTable = &schema.Table{
Name: "notes",
Columns: NotesColumns,
PrimaryKey: []*schema.Column{NotesColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "notes_users_author",
Columns: []*schema.Column{NotesColumns[10]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
},
}
// ServerMetadataColumns holds the columns for the "server_metadata" table.
ServerMetadataColumns = []*schema.Column{
{Name: "id", Type: field.TypeUUID},
{Name: "is_remote", Type: field.TypeBool},
{Name: "uri", Type: field.TypeString},
{Name: "extensions", Type: field.TypeJSON},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime},
{Name: "name", Type: field.TypeString},
{Name: "description", Type: field.TypeString, Nullable: true},
{Name: "version", Type: field.TypeString},
{Name: "supported_extensions", Type: field.TypeJSON},
{Name: "server_metadata_follower", Type: field.TypeUUID},
{Name: "server_metadata_followee", Type: field.TypeUUID},
}
// ServerMetadataTable holds the schema information for the "server_metadata" table.
ServerMetadataTable = &schema.Table{
Name: "server_metadata",
Columns: ServerMetadataColumns,
PrimaryKey: []*schema.Column{ServerMetadataColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "server_metadata_users_follower",
Columns: []*schema.Column{ServerMetadataColumns[10]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "server_metadata_users_followee",
Columns: []*schema.Column{ServerMetadataColumns[11]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
},
Indexes: []*schema.Index{
{
Name: "servermetadata_server_metadata_follower_server_metadata_followee",
Unique: true,
Columns: []*schema.Column{ServerMetadataColumns[10], ServerMetadataColumns[11]},
},
},
}
// UsersColumns holds the columns for the "users" table.
UsersColumns = []*schema.Column{
{Name: "id", Type: field.TypeUUID},
{Name: "is_remote", Type: field.TypeBool},
{Name: "uri", Type: field.TypeString},
{Name: "extensions", Type: field.TypeJSON},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime},
{Name: "username", Type: field.TypeString, Unique: true, Size: 32},
{Name: "password_hash", Type: field.TypeBytes, Nullable: true},
{Name: "display_name", Type: field.TypeString, Nullable: true, Size: 256},
{Name: "biography", Type: field.TypeString, Nullable: true},
{Name: "public_key", Type: field.TypeBytes},
{Name: "private_key", Type: field.TypeBytes, Nullable: true},
{Name: "indexable", Type: field.TypeBool, Default: true},
{Name: "privacy_level", Type: field.TypeEnum, Enums: []string{"public", "restricted", "private"}, Default: "public"},
{Name: "fields", Type: field.TypeJSON},
{Name: "inbox", Type: field.TypeString},
{Name: "featured", Type: field.TypeString},
{Name: "followers", Type: field.TypeString},
{Name: "following", Type: field.TypeString},
{Name: "outbox", Type: field.TypeString},
{Name: "user_avatar_image", Type: field.TypeInt, Nullable: true},
{Name: "user_header_image", Type: field.TypeInt, Nullable: true},
}
// UsersTable holds the schema information for the "users" table.
UsersTable = &schema.Table{
Name: "users",
Columns: UsersColumns,
PrimaryKey: []*schema.Column{UsersColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "users_images_avatarImage",
Columns: []*schema.Column{UsersColumns[20]},
RefColumns: []*schema.Column{ImagesColumns[0]},
OnDelete: schema.SetNull,
},
{
Symbol: "users_images_headerImage",
Columns: []*schema.Column{UsersColumns[21]},
RefColumns: []*schema.Column{ImagesColumns[0]},
OnDelete: schema.SetNull,
},
},
}
// NoteMentionsColumns holds the columns for the "note_mentions" table.
NoteMentionsColumns = []*schema.Column{
{Name: "note_id", Type: field.TypeUUID},
{Name: "user_id", Type: field.TypeUUID},
}
// NoteMentionsTable holds the schema information for the "note_mentions" table.
NoteMentionsTable = &schema.Table{
Name: "note_mentions",
Columns: NoteMentionsColumns,
PrimaryKey: []*schema.Column{NoteMentionsColumns[0], NoteMentionsColumns[1]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "note_mentions_note_id",
Columns: []*schema.Column{NoteMentionsColumns[0]},
RefColumns: []*schema.Column{NotesColumns[0]},
OnDelete: schema.Cascade,
},
{
Symbol: "note_mentions_user_id",
Columns: []*schema.Column{NoteMentionsColumns[1]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.Cascade,
},
},
}
// Tables holds all the tables in the schema.
Tables = []*schema.Table{
AttachmentsTable,
FollowsTable,
ImagesTable,
NotesTable,
ServerMetadataTable,
UsersTable,
NoteMentionsTable,
}
)
func init() {
AttachmentsTable.ForeignKeys[0].RefTable = UsersTable
AttachmentsTable.ForeignKeys[1].RefTable = NotesTable
FollowsTable.ForeignKeys[0].RefTable = UsersTable
FollowsTable.ForeignKeys[1].RefTable = UsersTable
NotesTable.ForeignKeys[0].RefTable = UsersTable
ServerMetadataTable.ForeignKeys[0].RefTable = UsersTable
ServerMetadataTable.ForeignKeys[1].RefTable = UsersTable
UsersTable.ForeignKeys[0].RefTable = ImagesTable
UsersTable.ForeignKeys[1].RefTable = ImagesTable
NoteMentionsTable.ForeignKeys[0].RefTable = NotesTable
NoteMentionsTable.ForeignKeys[1].RefTable = UsersTable
}