204 lines
6.7 KiB
Go
204 lines
6.7 KiB
Go
|
// Code generated by ent, DO NOT EDIT.
|
||
|
|
||
|
package migrate
|
||
|
|
||
|
import (
|
||
|
"entgo.io/ent/dialect/entsql"
|
||
|
"entgo.io/ent/dialect/sql/schema"
|
||
|
"entgo.io/ent/schema/field"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
// AccessControlsColumns holds the columns for the "access_controls" table.
|
||
|
AccessControlsColumns = []*schema.Column{
|
||
|
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||
|
{Name: "created_at", Type: field.TypeTime},
|
||
|
{Name: "updated_at", Type: field.TypeTime},
|
||
|
{Name: "ptype", Type: field.TypeString, Default: ""},
|
||
|
{Name: "v0", Type: field.TypeString, Default: ""},
|
||
|
{Name: "v1", Type: field.TypeString, Default: ""},
|
||
|
{Name: "v2", Type: field.TypeString, Default: ""},
|
||
|
{Name: "v3", Type: field.TypeString, Default: ""},
|
||
|
{Name: "v4", Type: field.TypeString, Default: ""},
|
||
|
{Name: "v5", Type: field.TypeString, Default: ""},
|
||
|
}
|
||
|
// AccessControlsTable holds the schema information for the "access_controls" table.
|
||
|
AccessControlsTable = &schema.Table{
|
||
|
Name: "access_controls",
|
||
|
Columns: AccessControlsColumns,
|
||
|
PrimaryKey: []*schema.Column{AccessControlsColumns[0]},
|
||
|
}
|
||
|
// AuditsColumns holds the columns for the "audits" table.
|
||
|
AuditsColumns = []*schema.Column{
|
||
|
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||
|
{Name: "created_at", Type: field.TypeTime},
|
||
|
{Name: "ent_name", Type: field.TypeString, Size: 50},
|
||
|
{Name: "ent_id", Type: field.TypeInt64},
|
||
|
{Name: "operation", Type: field.TypeEnum, Enums: []string{"Create", "Update", "UpdateOne", "Delete", "DeleteOne"}},
|
||
|
{Name: "description", Type: field.TypeString, Size: 1000},
|
||
|
{Name: "ip", Type: field.TypeString, Nullable: true, Size: 40},
|
||
|
{Name: "user_name", Type: field.TypeString, Nullable: true, Size: 150},
|
||
|
{Name: "user_id", Type: field.TypeInt64, Nullable: true},
|
||
|
}
|
||
|
// AuditsTable holds the schema information for the "audits" table.
|
||
|
AuditsTable = &schema.Table{
|
||
|
Name: "audits",
|
||
|
Columns: AuditsColumns,
|
||
|
PrimaryKey: []*schema.Column{AuditsColumns[0]},
|
||
|
ForeignKeys: []*schema.ForeignKey{
|
||
|
{
|
||
|
Symbol: "audits_users_audit_logs",
|
||
|
Columns: []*schema.Column{AuditsColumns[8]},
|
||
|
RefColumns: []*schema.Column{UsersColumns[0]},
|
||
|
OnDelete: schema.SetNull,
|
||
|
},
|
||
|
},
|
||
|
Indexes: []*schema.Index{
|
||
|
{
|
||
|
Name: "audit_ent_name_ent_id",
|
||
|
Unique: false,
|
||
|
Columns: []*schema.Column{AuditsColumns[2], AuditsColumns[3]},
|
||
|
},
|
||
|
{
|
||
|
Name: "audit_operation",
|
||
|
Unique: false,
|
||
|
Columns: []*schema.Column{AuditsColumns[4]},
|
||
|
},
|
||
|
{
|
||
|
Name: "audit_ip",
|
||
|
Unique: false,
|
||
|
Columns: []*schema.Column{AuditsColumns[6]},
|
||
|
},
|
||
|
},
|
||
|
}
|
||
|
// RolesColumns holds the columns for the "roles" table.
|
||
|
RolesColumns = []*schema.Column{
|
||
|
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||
|
{Name: "name", Type: field.TypeString},
|
||
|
}
|
||
|
// RolesTable holds the schema information for the "roles" table.
|
||
|
RolesTable = &schema.Table{
|
||
|
Name: "roles",
|
||
|
Columns: RolesColumns,
|
||
|
PrimaryKey: []*schema.Column{RolesColumns[0]},
|
||
|
}
|
||
|
// TodosColumns holds the columns for the "todos" table.
|
||
|
TodosColumns = []*schema.Column{
|
||
|
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
|
}
|
||
|
// TodosTable holds the schema information for the "todos" table.
|
||
|
TodosTable = &schema.Table{
|
||
|
Name: "todos",
|
||
|
Columns: TodosColumns,
|
||
|
PrimaryKey: []*schema.Column{TodosColumns[0]},
|
||
|
}
|
||
|
// UsersColumns holds the columns for the "users" table.
|
||
|
UsersColumns = []*schema.Column{
|
||
|
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||
|
{Name: "created_at", Type: field.TypeTime},
|
||
|
{Name: "updated_at", Type: field.TypeTime},
|
||
|
{Name: "email", Type: field.TypeString, Unique: true},
|
||
|
{Name: "email_verified", Type: field.TypeBool, Default: false},
|
||
|
{Name: "phone", Type: field.TypeString, Size: 20},
|
||
|
{Name: "phone_verified", Type: field.TypeBool, Default: false},
|
||
|
{Name: "pwd_salt", Type: field.TypeString},
|
||
|
{Name: "pwd_hash", Type: field.TypeString},
|
||
|
{Name: "login_failed_count", Type: field.TypeUint8, Nullable: true, Default: 0},
|
||
|
{Name: "login_attempt_on", Type: field.TypeTime, Nullable: true},
|
||
|
{Name: "login_locked_until", Type: field.TypeTime, Nullable: true},
|
||
|
{Name: "first_name", Type: field.TypeString, Size: 30},
|
||
|
{Name: "middle_name", Type: field.TypeString, Size: 30},
|
||
|
{Name: "last_name", Type: field.TypeString, Size: 30},
|
||
|
{Name: "status", Type: field.TypeEnum, Enums: []string{"Pending", "Active", "InActive"}, Default: "Pending"},
|
||
|
}
|
||
|
// UsersTable holds the schema information for the "users" table.
|
||
|
UsersTable = &schema.Table{
|
||
|
Name: "users",
|
||
|
Columns: UsersColumns,
|
||
|
PrimaryKey: []*schema.Column{UsersColumns[0]},
|
||
|
Indexes: []*schema.Index{
|
||
|
{
|
||
|
Name: "user_created_at",
|
||
|
Unique: false,
|
||
|
Columns: []*schema.Column{UsersColumns[1]},
|
||
|
Annotation: &entsql.IndexAnnotation{
|
||
|
Desc: true,
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
Name: "user_updated_at",
|
||
|
Unique: false,
|
||
|
Columns: []*schema.Column{UsersColumns[2]},
|
||
|
Annotation: &entsql.IndexAnnotation{
|
||
|
Desc: true,
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
Name: "user_phone",
|
||
|
Unique: false,
|
||
|
Columns: []*schema.Column{UsersColumns[5]},
|
||
|
},
|
||
|
{
|
||
|
Name: "user_status",
|
||
|
Unique: false,
|
||
|
Columns: []*schema.Column{UsersColumns[15]},
|
||
|
},
|
||
|
},
|
||
|
}
|
||
|
// UserSessionsColumns holds the columns for the "user_sessions" table.
|
||
|
UserSessionsColumns = []*schema.Column{
|
||
|
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||
|
{Name: "issued_at", Type: field.TypeTime},
|
||
|
{Name: "expires_at", Type: field.TypeTime},
|
||
|
{Name: "invalidated", Type: field.TypeBool, Nullable: true, Default: false},
|
||
|
{Name: "user_agent", Type: field.TypeString, Size: 50},
|
||
|
{Name: "ip", Type: field.TypeString, Size: 40},
|
||
|
{Name: "user_id", Type: field.TypeInt64},
|
||
|
}
|
||
|
// UserSessionsTable holds the schema information for the "user_sessions" table.
|
||
|
UserSessionsTable = &schema.Table{
|
||
|
Name: "user_sessions",
|
||
|
Columns: UserSessionsColumns,
|
||
|
PrimaryKey: []*schema.Column{UserSessionsColumns[0]},
|
||
|
ForeignKeys: []*schema.ForeignKey{
|
||
|
{
|
||
|
Symbol: "user_sessions_users_sessions",
|
||
|
Columns: []*schema.Column{UserSessionsColumns[6]},
|
||
|
RefColumns: []*schema.Column{UsersColumns[0]},
|
||
|
OnDelete: schema.NoAction,
|
||
|
},
|
||
|
},
|
||
|
Indexes: []*schema.Index{
|
||
|
{
|
||
|
Name: "usersession_expires_at",
|
||
|
Unique: false,
|
||
|
Columns: []*schema.Column{UserSessionsColumns[2]},
|
||
|
},
|
||
|
{
|
||
|
Name: "usersession_invalidated",
|
||
|
Unique: false,
|
||
|
Columns: []*schema.Column{UserSessionsColumns[3]},
|
||
|
},
|
||
|
{
|
||
|
Name: "usersession_ip",
|
||
|
Unique: false,
|
||
|
Columns: []*schema.Column{UserSessionsColumns[5]},
|
||
|
},
|
||
|
},
|
||
|
}
|
||
|
// Tables holds all the tables in the schema.
|
||
|
Tables = []*schema.Table{
|
||
|
AccessControlsTable,
|
||
|
AuditsTable,
|
||
|
RolesTable,
|
||
|
TodosTable,
|
||
|
UsersTable,
|
||
|
UserSessionsTable,
|
||
|
}
|
||
|
)
|
||
|
|
||
|
func init() {
|
||
|
AuditsTable.ForeignKeys[0].RefTable = UsersTable
|
||
|
UserSessionsTable.ForeignKeys[0].RefTable = UsersTable
|
||
|
}
|