// Code generated by ent, DO NOT EDIT.

package migrate

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

var (
	// ProjectsColumns holds the columns for the "projects" table.
	ProjectsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "name", Type: field.TypeString, Unique: true},
		{Name: "team_project", Type: field.TypeInt, Nullable: true},
	}
	// ProjectsTable holds the schema information for the "projects" table.
	ProjectsTable = &schema.Table{
		Name:       "projects",
		Columns:    ProjectsColumns,
		PrimaryKey: []*schema.Column{ProjectsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "projects_teams_project",
				Columns:    []*schema.Column{ProjectsColumns[2]},
				RefColumns: []*schema.Column{TeamsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// TeamsColumns holds the columns for the "teams" table.
	TeamsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "name", Type: field.TypeString},
	}
	// TeamsTable holds the schema information for the "teams" table.
	TeamsTable = &schema.Table{
		Name:       "teams",
		Columns:    TeamsColumns,
		PrimaryKey: []*schema.Column{TeamsColumns[0]},
	}
	// UsersColumns holds the columns for the "users" table.
	UsersColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "name", Type: field.TypeString, Unique: true},
		{Name: "password", Type: field.TypeString},
		{Name: "role", Type: field.TypeEnum, Enums: []string{"admin", "user", "visitor"}},
	}
	// UsersTable holds the schema information for the "users" table.
	UsersTable = &schema.Table{
		Name:       "users",
		Columns:    UsersColumns,
		PrimaryKey: []*schema.Column{UsersColumns[0]},
	}
	// UserTeamsColumns holds the columns for the "user_teams" table.
	UserTeamsColumns = []*schema.Column{
		{Name: "user_id", Type: field.TypeInt},
		{Name: "team_id", Type: field.TypeInt},
	}
	// UserTeamsTable holds the schema information for the "user_teams" table.
	UserTeamsTable = &schema.Table{
		Name:       "user_teams",
		Columns:    UserTeamsColumns,
		PrimaryKey: []*schema.Column{UserTeamsColumns[0], UserTeamsColumns[1]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "user_teams_user_id",
				Columns:    []*schema.Column{UserTeamsColumns[0]},
				RefColumns: []*schema.Column{UsersColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "user_teams_team_id",
				Columns:    []*schema.Column{UserTeamsColumns[1]},
				RefColumns: []*schema.Column{TeamsColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// Tables holds all the tables in the schema.
	Tables = []*schema.Table{
		ProjectsTable,
		TeamsTable,
		UsersTable,
		UserTeamsTable,
	}
)

func init() {
	ProjectsTable.ForeignKeys[0].RefTable = TeamsTable
	UserTeamsTable.ForeignKeys[0].RefTable = UsersTable
	UserTeamsTable.ForeignKeys[1].RefTable = TeamsTable
}
