pcmt/ent/migrate/schema.go
surtur 247c95f753
All checks were successful
continuous-integration/drone/push Build is passing
go: save all breaches as cache, search by name
* also switch addedDate column to string temporarily, until saving
  yy-mm-dd as time is solved...
2023-08-24 03:59:50 +02:00

222 lines
8.6 KiB
Go

// Code generated by ent, DO NOT EDIT.
package migrate
import (
"entgo.io/ent/dialect/sql/schema"
"entgo.io/ent/schema/field"
)
var (
// AgeKeysColumns holds the columns for the "age_keys" table.
AgeKeysColumns = []*schema.Column{
{Name: "id", Type: field.TypeUUID, Unique: true},
{Name: "key", Type: field.TypeBytes},
{Name: "created", Type: field.TypeTime},
{Name: "updated", Type: field.TypeTime},
{Name: "owner", Type: field.TypeUUID, Unique: true},
}
// AgeKeysTable holds the schema information for the "age_keys" table.
AgeKeysTable = &schema.Table{
Name: "age_keys",
Columns: AgeKeysColumns,
PrimaryKey: []*schema.Column{AgeKeysColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "age_keys_users_agekey",
Columns: []*schema.Column{AgeKeysColumns[4]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
},
}
// HibPsColumns holds the columns for the "hib_ps" table.
HibPsColumns = []*schema.Column{
{Name: "id", Type: field.TypeUUID, Unique: true},
{Name: "name", Type: field.TypeString, Unique: true},
{Name: "title", Type: field.TypeString, Unique: true},
{Name: "domain", Type: field.TypeString},
{Name: "breach_date", Type: field.TypeString},
{Name: "added_date", Type: field.TypeTime},
{Name: "modified_date", Type: field.TypeTime},
{Name: "pwn_count", Type: field.TypeInt},
{Name: "description", Type: field.TypeString, Nullable: true},
{Name: "dataclasses", Type: field.TypeJSON},
{Name: "is_verified", Type: field.TypeBool, Default: false},
{Name: "is_fabricated", Type: field.TypeBool, Default: false},
{Name: "is_sensitive", Type: field.TypeBool, Default: false},
{Name: "is_retired", Type: field.TypeBool, Default: false},
{Name: "is_spam_list", Type: field.TypeBool, Default: false},
{Name: "is_malware", Type: field.TypeBool, Default: false},
{Name: "logo_path", Type: field.TypeString, Nullable: true},
{Name: "tracked_breaches_hibp", Type: field.TypeUUID, Nullable: true},
}
// HibPsTable holds the schema information for the "hib_ps" table.
HibPsTable = &schema.Table{
Name: "hib_ps",
Columns: HibPsColumns,
PrimaryKey: []*schema.Column{HibPsColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "hib_ps_tracked_breaches_hibp",
Columns: []*schema.Column{HibPsColumns[17]},
RefColumns: []*schema.Column{TrackedBreachesColumns[0]},
OnDelete: schema.SetNull,
},
},
}
// LocalBreachesColumns holds the columns for the "local_breaches" table.
LocalBreachesColumns = []*schema.Column{
{Name: "id", Type: field.TypeUUID, Unique: true},
{Name: "name", Type: field.TypeString, Unique: true},
{Name: "date", Type: field.TypeTime},
{Name: "description", Type: field.TypeString, Nullable: true},
{Name: "is_verified", Type: field.TypeBool},
{Name: "contains_passwords", Type: field.TypeBool},
{Name: "contains_hashes", Type: field.TypeBool},
{Name: "contains_emails", Type: field.TypeBool},
{Name: "contains_usernames", Type: field.TypeBool},
{Name: "hash_type", Type: field.TypeString, Nullable: true},
{Name: "hash_salted", Type: field.TypeBool, Nullable: true},
{Name: "hash_peppered", Type: field.TypeBool, Nullable: true},
{Name: "data", Type: field.TypeJSON, Nullable: true},
{Name: "created_at", Type: field.TypeTime},
}
// LocalBreachesTable holds the schema information for the "local_breaches" table.
LocalBreachesTable = &schema.Table{
Name: "local_breaches",
Columns: LocalBreachesColumns,
PrimaryKey: []*schema.Column{LocalBreachesColumns[0]},
}
// SearchQueriesColumns holds the columns for the "search_queries" table.
SearchQueriesColumns = []*schema.Column{
{Name: "id", Type: field.TypeUUID, Unique: true},
{Name: "query", Type: field.TypeString},
{Name: "created", Type: field.TypeTime},
{Name: "owner", Type: field.TypeUUID},
}
// SearchQueriesTable holds the schema information for the "search_queries" table.
SearchQueriesTable = &schema.Table{
Name: "search_queries",
Columns: SearchQueriesColumns,
PrimaryKey: []*schema.Column{SearchQueriesColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "search_queries_users_search_queries",
Columns: []*schema.Column{SearchQueriesColumns[3]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
},
}
// SettingsColumns holds the columns for the "settings" table.
SettingsColumns = []*schema.Column{
{Name: "id", Type: field.TypeUUID, Unique: true},
{Name: "hibp_api_key", Type: field.TypeString, Unique: true, Nullable: true},
{Name: "dehashed_api_key", Type: field.TypeString, Unique: true, Nullable: true},
{Name: "searches", Type: field.TypeUint64, Default: 0},
}
// SettingsTable holds the schema information for the "settings" table.
SettingsTable = &schema.Table{
Name: "settings",
Columns: SettingsColumns,
PrimaryKey: []*schema.Column{SettingsColumns[0]},
}
// SetupsColumns holds the columns for the "setups" table.
SetupsColumns = []*schema.Column{
{Name: "id", Type: field.TypeUUID, Unique: true},
{Name: "set_up_at", Type: field.TypeTime},
}
// SetupsTable holds the schema information for the "setups" table.
SetupsTable = &schema.Table{
Name: "setups",
Columns: SetupsColumns,
PrimaryKey: []*schema.Column{SetupsColumns[0]},
}
// TrackedBreachesColumns holds the columns for the "tracked_breaches" table.
TrackedBreachesColumns = []*schema.Column{
{Name: "id", Type: field.TypeUUID, Unique: true},
{Name: "breach", Type: field.TypeUUID},
{Name: "online", Type: field.TypeBool, Default: true},
{Name: "owner", Type: field.TypeUUID},
}
// TrackedBreachesTable holds the schema information for the "tracked_breaches" table.
TrackedBreachesTable = &schema.Table{
Name: "tracked_breaches",
Columns: TrackedBreachesColumns,
PrimaryKey: []*schema.Column{TrackedBreachesColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "tracked_breaches_users_tracked_breaches",
Columns: []*schema.Column{TrackedBreachesColumns[3]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
},
}
// UsersColumns holds the columns for the "users" table.
UsersColumns = []*schema.Column{
{Name: "id", Type: field.TypeUUID, Unique: true},
{Name: "username", Type: field.TypeString, Unique: true},
{Name: "email", Type: field.TypeString, Unique: true},
{Name: "password", Type: field.TypeBytes},
{Name: "is_admin", Type: field.TypeBool, Default: false},
{Name: "is_active", Type: field.TypeBool, Default: true},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime},
{Name: "last_login", Type: field.TypeTime},
}
// UsersTable holds the schema information for the "users" table.
UsersTable = &schema.Table{
Name: "users",
Columns: UsersColumns,
PrimaryKey: []*schema.Column{UsersColumns[0]},
}
// TrackedBreachesLocalbreachColumns holds the columns for the "tracked_breaches_localbreach" table.
TrackedBreachesLocalbreachColumns = []*schema.Column{
{Name: "tracked_breaches_id", Type: field.TypeUUID},
{Name: "local_breach_id", Type: field.TypeUUID},
}
// TrackedBreachesLocalbreachTable holds the schema information for the "tracked_breaches_localbreach" table.
TrackedBreachesLocalbreachTable = &schema.Table{
Name: "tracked_breaches_localbreach",
Columns: TrackedBreachesLocalbreachColumns,
PrimaryKey: []*schema.Column{TrackedBreachesLocalbreachColumns[0], TrackedBreachesLocalbreachColumns[1]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "tracked_breaches_localbreach_tracked_breaches_id",
Columns: []*schema.Column{TrackedBreachesLocalbreachColumns[0]},
RefColumns: []*schema.Column{TrackedBreachesColumns[0]},
OnDelete: schema.Cascade,
},
{
Symbol: "tracked_breaches_localbreach_local_breach_id",
Columns: []*schema.Column{TrackedBreachesLocalbreachColumns[1]},
RefColumns: []*schema.Column{LocalBreachesColumns[0]},
OnDelete: schema.Cascade,
},
},
}
// Tables holds all the tables in the schema.
Tables = []*schema.Table{
AgeKeysTable,
HibPsTable,
LocalBreachesTable,
SearchQueriesTable,
SettingsTable,
SetupsTable,
TrackedBreachesTable,
UsersTable,
TrackedBreachesLocalbreachTable,
}
)
func init() {
AgeKeysTable.ForeignKeys[0].RefTable = UsersTable
HibPsTable.ForeignKeys[0].RefTable = TrackedBreachesTable
SearchQueriesTable.ForeignKeys[0].RefTable = UsersTable
TrackedBreachesTable.ForeignKeys[0].RefTable = UsersTable
TrackedBreachesLocalbreachTable.ForeignKeys[0].RefTable = TrackedBreachesTable
TrackedBreachesLocalbreachTable.ForeignKeys[1].RefTable = LocalBreachesTable
}