// Code generated by entc, DO NOT EDIT.

package migrate

import (
	"entgo.io/ent/dialect/sql/schema"
	"entgo.io/ent/schema/field"
)

var (
	// AccountsColumns holds the columns for the "accounts" table.
	AccountsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created", Type: field.TypeTime},
		{Name: "modified", Type: field.TypeTime, Nullable: true},
		{Name: "username", Type: field.TypeString},
		{Name: "password", Type: field.TypeBytes},
		{Name: "super", Type: field.TypeBool},
		{Name: "active", Type: field.TypeBool},
	}
	// AccountsTable holds the schema information for the "accounts" table.
	AccountsTable = &schema.Table{
		Name:       "accounts",
		Columns:    AccountsColumns,
		PrimaryKey: []*schema.Column{AccountsColumns[0]},
	}
	// AliasColumns holds the columns for the "alias" table.
	AliasColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created", Type: field.TypeTime},
		{Name: "modified", Type: field.TypeTime, Nullable: true},
		{Name: "goto", Type: field.TypeString, Size: 2147483647},
		{Name: "active", Type: field.TypeBool},
		{Name: "domain_id", Type: field.TypeInt64, Nullable: true},
	}
	// AliasTable holds the schema information for the "alias" table.
	AliasTable = &schema.Table{
		Name:       "alias",
		Columns:    AliasColumns,
		PrimaryKey: []*schema.Column{AliasColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "alias_domains_aliases",
				Columns:    []*schema.Column{AliasColumns[5]},
				RefColumns: []*schema.Column{DomainsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// DomainsColumns holds the columns for the "domains" table.
	DomainsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "created", Type: field.TypeTime},
		{Name: "modified", Type: field.TypeTime, Nullable: true},
		{Name: "domain", Type: field.TypeString},
		{Name: "description", Type: field.TypeString, Nullable: true},
		{Name: "max_aliases", Type: field.TypeInt64},
		{Name: "max_mailboxes", Type: field.TypeInt64},
		{Name: "max_quota", Type: field.TypeInt64},
		{Name: "quota", Type: field.TypeInt64},
		{Name: "transport", Type: field.TypeString},
		{Name: "backup_mx", Type: field.TypeBool},
		{Name: "active", Type: field.TypeBool},
	}
	// DomainsTable holds the schema information for the "domains" table.
	DomainsTable = &schema.Table{
		Name:       "domains",
		Columns:    DomainsColumns,
		PrimaryKey: []*schema.Column{DomainsColumns[0]},
	}
	// LogentriesColumns holds the columns for the "logentries" table.
	LogentriesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "timestamp", Type: field.TypeTime},
		{Name: "action", Type: field.TypeString},
		{Name: "data", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "account_id", Type: field.TypeInt64, Nullable: true},
		{Name: "domain_id", Type: field.TypeInt64, Nullable: true},
	}
	// LogentriesTable holds the schema information for the "logentries" table.
	LogentriesTable = &schema.Table{
		Name:       "logentries",
		Columns:    LogentriesColumns,
		PrimaryKey: []*schema.Column{LogentriesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "logentries_accounts_logs",
				Columns:    []*schema.Column{LogentriesColumns[4]},
				RefColumns: []*schema.Column{AccountsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "logentries_domains_logs",
				Columns:    []*schema.Column{LogentriesColumns[5]},
				RefColumns: []*schema.Column{DomainsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// MailboxesColumns holds the columns for the "mailboxes" table.
	MailboxesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "active", Type: field.TypeBool},
		{Name: "created", Type: field.TypeTime},
		{Name: "modified", Type: field.TypeTime, Nullable: true},
		{Name: "username", Type: field.TypeString},
		{Name: "password", Type: field.TypeBytes},
		{Name: "name", Type: field.TypeString, Nullable: true},
		{Name: "quota", Type: field.TypeInt64},
		{Name: "local_part", Type: field.TypeString},
		{Name: "homedir", Type: field.TypeString, Nullable: true},
		{Name: "maildir", Type: field.TypeString, Nullable: true},
		{Name: "uid", Type: field.TypeInt32, Nullable: true},
		{Name: "gid", Type: field.TypeInt32, Nullable: true},
		{Name: "domain_id", Type: field.TypeInt64, Nullable: true},
	}
	// MailboxesTable holds the schema information for the "mailboxes" table.
	MailboxesTable = &schema.Table{
		Name:       "mailboxes",
		Columns:    MailboxesColumns,
		PrimaryKey: []*schema.Column{MailboxesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "mailboxes_domains_mailboxes",
				Columns:    []*schema.Column{MailboxesColumns[13]},
				RefColumns: []*schema.Column{DomainsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// AccountDomainsColumns holds the columns for the "account_domains" table.
	AccountDomainsColumns = []*schema.Column{
		{Name: "account_id", Type: field.TypeInt64},
		{Name: "domain_id", Type: field.TypeInt64},
	}
	// AccountDomainsTable holds the schema information for the "account_domains" table.
	AccountDomainsTable = &schema.Table{
		Name:       "account_domains",
		Columns:    AccountDomainsColumns,
		PrimaryKey: []*schema.Column{AccountDomainsColumns[0], AccountDomainsColumns[1]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "account_domains_account_id",
				Columns:    []*schema.Column{AccountDomainsColumns[0]},
				RefColumns: []*schema.Column{AccountsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "account_domains_domain_id",
				Columns:    []*schema.Column{AccountDomainsColumns[1]},
				RefColumns: []*schema.Column{DomainsColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// Tables holds all the tables in the schema.
	Tables = []*schema.Table{
		AccountsTable,
		AliasTable,
		DomainsTable,
		LogentriesTable,
		MailboxesTable,
		AccountDomainsTable,
	}
)

func init() {
	AliasTable.ForeignKeys[0].RefTable = DomainsTable
	LogentriesTable.ForeignKeys[0].RefTable = AccountsTable
	LogentriesTable.ForeignKeys[1].RefTable = DomainsTable
	MailboxesTable.ForeignKeys[0].RefTable = DomainsTable
	AccountDomainsTable.ForeignKeys[0].RefTable = AccountsTable
	AccountDomainsTable.ForeignKeys[1].RefTable = DomainsTable
}
