migrate

package
v0.0.0-...-c5055fb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// WithGlobalUniqueID sets the universal ids options to the migration.
	// If this option is enabled, ent migration will allocate a 1<<32 range
	// for the ids of each entity (table).
	// Note that this option cannot be applied on tables that already exist.
	WithGlobalUniqueID = schema.WithGlobalUniqueID
	// WithDropColumn sets the drop column option to the migration.
	// If this option is enabled, ent migration will drop old columns
	// that were used for both fields and edges. This defaults to false.
	WithDropColumn = schema.WithDropColumn
	// WithDropIndex sets the drop index option to the migration.
	// If this option is enabled, ent migration will drop old indexes
	// that were defined in the schema. This defaults to false.
	// Note that unique constraints are defined using `UNIQUE INDEX`,
	// and therefore, it's recommended to enable this option to get more
	// flexibility in the schema changes.
	WithDropIndex = schema.WithDropIndex
	// WithForeignKeys enables creating foreign-key in schema DDL. This defaults to true.
	WithForeignKeys = schema.WithForeignKeys
)
View Source
var (
	// AbilityBonusColumns holds the columns for the "ability_bonus" table.
	AbilityBonusColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "bonus", Type: field.TypeInt},
		{Name: "ability_score_id", Type: field.TypeInt},
		{Name: "race_ability_bonuses", Type: field.TypeInt, Nullable: true},
		{Name: "subrace_ability_bonuses", Type: field.TypeInt, Nullable: true},
	}
	// AbilityBonusTable holds the schema information for the "ability_bonus" table.
	AbilityBonusTable = &schema.Table{
		Name:       "ability_bonus",
		Columns:    AbilityBonusColumns,
		PrimaryKey: []*schema.Column{AbilityBonusColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "ability_bonus_ability_scores_ability_bonuses",
				Columns:    []*schema.Column{AbilityBonusColumns[2]},
				RefColumns: []*schema.Column{AbilityScoresColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "ability_bonus_races_ability_bonuses",
				Columns:    []*schema.Column{AbilityBonusColumns[3]},
				RefColumns: []*schema.Column{RacesColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "ability_bonus_subraces_ability_bonuses",
				Columns:    []*schema.Column{AbilityBonusColumns[4]},
				RefColumns: []*schema.Column{SubracesColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// AbilityScoresColumns holds the columns for the "ability_scores" table.
	AbilityScoresColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "indx", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString},
		{Name: "full_name", Type: field.TypeString},
		{Name: "desc", Type: field.TypeJSON},
		{Name: "proficiency_saving_throw", Type: field.TypeInt, Nullable: true},
	}
	// AbilityScoresTable holds the schema information for the "ability_scores" table.
	AbilityScoresTable = &schema.Table{
		Name:       "ability_scores",
		Columns:    AbilityScoresColumns,
		PrimaryKey: []*schema.Column{AbilityScoresColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "ability_scores_proficiencies_saving_throw",
				Columns:    []*schema.Column{AbilityScoresColumns[5]},
				RefColumns: []*schema.Column{ProficienciesColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// ArmorsColumns holds the columns for the "armors" table.
	ArmorsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "indx", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString},
		{Name: "armor_category", Type: field.TypeString},
		{Name: "stealth_disadvantage", Type: field.TypeBool},
		{Name: "min_strength", Type: field.TypeInt},
		{Name: "equipment_id", Type: field.TypeInt, Unique: true},
	}
	// ArmorsTable holds the schema information for the "armors" table.
	ArmorsTable = &schema.Table{
		Name:       "armors",
		Columns:    ArmorsColumns,
		PrimaryKey: []*schema.Column{ArmorsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "armors_equipment_armor",
				Columns:    []*schema.Column{ArmorsColumns[6]},
				RefColumns: []*schema.Column{EquipmentColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
	}
	// ArmorClassesColumns holds the columns for the "armor_classes" table.
	ArmorClassesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "base", Type: field.TypeInt},
		{Name: "dex_bonus", Type: field.TypeBool},
		{Name: "max_bonus", Type: field.TypeInt, Nullable: true},
		{Name: "armor_armor_class", Type: field.TypeInt, Nullable: true},
	}
	// ArmorClassesTable holds the schema information for the "armor_classes" table.
	ArmorClassesTable = &schema.Table{
		Name:       "armor_classes",
		Columns:    ArmorClassesColumns,
		PrimaryKey: []*schema.Column{ArmorClassesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "armor_classes_armors_armor_class",
				Columns:    []*schema.Column{ArmorClassesColumns[4]},
				RefColumns: []*schema.Column{ArmorsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// ClassesColumns holds the columns for the "classes" table.
	ClassesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "indx", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString},
		{Name: "hit_die", Type: field.TypeInt},
	}
	// ClassesTable holds the schema information for the "classes" table.
	ClassesTable = &schema.Table{
		Name:       "classes",
		Columns:    ClassesColumns,
		PrimaryKey: []*schema.Column{ClassesColumns[0]},
	}
	// ClassEquipmentsColumns holds the columns for the "class_equipments" table.
	ClassEquipmentsColumns = []*schema.Column{
		{Name: "quantity", Type: field.TypeInt},
		{Name: "class_id", Type: field.TypeInt},
		{Name: "equipment_id", Type: field.TypeInt},
	}
	// ClassEquipmentsTable holds the schema information for the "class_equipments" table.
	ClassEquipmentsTable = &schema.Table{
		Name:       "class_equipments",
		Columns:    ClassEquipmentsColumns,
		PrimaryKey: []*schema.Column{ClassEquipmentsColumns[1], ClassEquipmentsColumns[2]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "class_equipments_classes_class",
				Columns:    []*schema.Column{ClassEquipmentsColumns[1]},
				RefColumns: []*schema.Column{ClassesColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "class_equipments_equipment_equipment",
				Columns:    []*schema.Column{ClassEquipmentsColumns[2]},
				RefColumns: []*schema.Column{EquipmentColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
	}
	// CoinsColumns holds the columns for the "coins" table.
	CoinsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "indx", Type: field.TypeString, Unique: true},
		{Name: "desc", Type: field.TypeString},
		{Name: "gold_conversion_rate", Type: field.TypeFloat64},
	}
	// CoinsTable holds the schema information for the "coins" table.
	CoinsTable = &schema.Table{
		Name:       "coins",
		Columns:    CoinsColumns,
		PrimaryKey: []*schema.Column{CoinsColumns[0]},
	}
	// DamageTypesColumns holds the columns for the "damage_types" table.
	DamageTypesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "indx", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString},
		{Name: "desc", Type: field.TypeJSON},
	}
	// DamageTypesTable holds the schema information for the "damage_types" table.
	DamageTypesTable = &schema.Table{
		Name:       "damage_types",
		Columns:    DamageTypesColumns,
		PrimaryKey: []*schema.Column{DamageTypesColumns[0]},
	}
	// EquipmentColumns holds the columns for the "equipment" table.
	EquipmentColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "indx", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString},
		{Name: "weight", Type: field.TypeInt, Nullable: true},
		{Name: "proficiency_equipment", Type: field.TypeInt, Nullable: true},
	}
	// EquipmentTable holds the schema information for the "equipment" table.
	EquipmentTable = &schema.Table{
		Name:       "equipment",
		Columns:    EquipmentColumns,
		PrimaryKey: []*schema.Column{EquipmentColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "equipment_proficiencies_equipment",
				Columns:    []*schema.Column{EquipmentColumns[4]},
				RefColumns: []*schema.Column{ProficienciesColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// EquipmentCategoriesColumns holds the columns for the "equipment_categories" table.
	EquipmentCategoriesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "name", Type: field.TypeString},
		{Name: "parent_category_id", Type: field.TypeInt, Nullable: true},
		{Name: "proficiency_equipment_category", Type: field.TypeInt, Nullable: true},
	}
	// EquipmentCategoriesTable holds the schema information for the "equipment_categories" table.
	EquipmentCategoriesTable = &schema.Table{
		Name:       "equipment_categories",
		Columns:    EquipmentCategoriesColumns,
		PrimaryKey: []*schema.Column{EquipmentCategoriesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "equipment_categories_equipment_categories_children",
				Columns:    []*schema.Column{EquipmentCategoriesColumns[2]},
				RefColumns: []*schema.Column{EquipmentCategoriesColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "equipment_categories_proficiencies_equipment_category",
				Columns:    []*schema.Column{EquipmentCategoriesColumns[3]},
				RefColumns: []*schema.Column{ProficienciesColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// EquipmentChoicesColumns holds the columns for the "equipment_choices" table.
	EquipmentChoicesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "choose", Type: field.TypeInt},
		{Name: "desc", Type: field.TypeString, Nullable: true},
	}
	// EquipmentChoicesTable holds the schema information for the "equipment_choices" table.
	EquipmentChoicesTable = &schema.Table{
		Name:       "equipment_choices",
		Columns:    EquipmentChoicesColumns,
		PrimaryKey: []*schema.Column{EquipmentChoicesColumns[0]},
	}
	// EquipmentCostsColumns holds the columns for the "equipment_costs" table.
	EquipmentCostsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "quantity", Type: field.TypeInt},
		{Name: "gp_value", Type: field.TypeFloat64},
		{Name: "equipment_id", Type: field.TypeInt, Unique: true},
		{Name: "coin_id", Type: field.TypeInt},
	}
	// EquipmentCostsTable holds the schema information for the "equipment_costs" table.
	EquipmentCostsTable = &schema.Table{
		Name:       "equipment_costs",
		Columns:    EquipmentCostsColumns,
		PrimaryKey: []*schema.Column{EquipmentCostsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "equipment_costs_equipment_cost",
				Columns:    []*schema.Column{EquipmentCostsColumns[3]},
				RefColumns: []*schema.Column{EquipmentColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "equipment_costs_coins_coin",
				Columns:    []*schema.Column{EquipmentCostsColumns[4]},
				RefColumns: []*schema.Column{CoinsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
	}
	// GearsColumns holds the columns for the "gears" table.
	GearsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "indx", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString},
		{Name: "gear_category", Type: field.TypeEnum, Enums: []string{"ammunition", "standard_gear", "kits", "equipment_packs", "arcane_foci", "druidic_foci", "holy_symbols", "other"}, Default: "other"},
		{Name: "quantity", Type: field.TypeInt, Nullable: true},
		{Name: "equipment_id", Type: field.TypeInt, Unique: true},
	}
	// GearsTable holds the schema information for the "gears" table.
	GearsTable = &schema.Table{
		Name:       "gears",
		Columns:    GearsColumns,
		PrimaryKey: []*schema.Column{GearsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "gears_equipment_gear",
				Columns:    []*schema.Column{GearsColumns[5]},
				RefColumns: []*schema.Column{EquipmentColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
	}
	// LanguagesColumns holds the columns for the "languages" table.
	LanguagesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "indx", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString},
		{Name: "desc", Type: field.TypeString},
		{Name: "language_type", Type: field.TypeEnum, Enums: []string{"STANDARD", "EXOTIC"}, Default: "STANDARD"},
		{Name: "script", Type: field.TypeEnum, Nullable: true, Enums: []string{"Common", "Dwarvish", "Elvish", "Infernal", "Draconic", "Celestial", "Abyssal", "Giant", "Gnomish", "Goblin", "Halfling", "Orc", "Other"}, Default: "Common"},
	}
	// LanguagesTable holds the schema information for the "languages" table.
	LanguagesTable = &schema.Table{
		Name:       "languages",
		Columns:    LanguagesColumns,
		PrimaryKey: []*schema.Column{LanguagesColumns[0]},
	}
	// MagicSchoolsColumns holds the columns for the "magic_schools" table.
	MagicSchoolsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "indx", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString},
		{Name: "desc", Type: field.TypeString},
	}
	// MagicSchoolsTable holds the schema information for the "magic_schools" table.
	MagicSchoolsTable = &schema.Table{
		Name:       "magic_schools",
		Columns:    MagicSchoolsColumns,
		PrimaryKey: []*schema.Column{MagicSchoolsColumns[0]},
	}
	// ProficienciesColumns holds the columns for the "proficiencies" table.
	ProficienciesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "indx", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString},
		{Name: "proficiency_category", Type: field.TypeString},
	}
	// ProficienciesTable holds the schema information for the "proficiencies" table.
	ProficienciesTable = &schema.Table{
		Name:       "proficiencies",
		Columns:    ProficienciesColumns,
		PrimaryKey: []*schema.Column{ProficienciesColumns[0]},
	}
	// ProficiencyChoicesColumns holds the columns for the "proficiency_choices" table.
	ProficiencyChoicesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "choose", Type: field.TypeInt},
		{Name: "desc", Type: field.TypeString, Nullable: true},
		{Name: "proficiency_choice_sub_choice", Type: field.TypeInt, Nullable: true},
	}
	// ProficiencyChoicesTable holds the schema information for the "proficiency_choices" table.
	ProficiencyChoicesTable = &schema.Table{
		Name:       "proficiency_choices",
		Columns:    ProficiencyChoicesColumns,
		PrimaryKey: []*schema.Column{ProficiencyChoicesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "proficiency_choices_proficiency_choices_sub_choice",
				Columns:    []*schema.Column{ProficiencyChoicesColumns[3]},
				RefColumns: []*schema.Column{ProficiencyChoicesColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// RacesColumns holds the columns for the "races" table.
	RacesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "indx", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString},
		{Name: "alignment", Type: field.TypeString},
		{Name: "age", Type: field.TypeString},
		{Name: "size", Type: field.TypeString},
		{Name: "size_description", Type: field.TypeString},
		{Name: "language_desc", Type: field.TypeString},
		{Name: "speed", Type: field.TypeInt},
	}
	// RacesTable holds the schema information for the "races" table.
	RacesTable = &schema.Table{
		Name:       "races",
		Columns:    RacesColumns,
		PrimaryKey: []*schema.Column{RacesColumns[0]},
	}
	// RulesColumns holds the columns for the "rules" table.
	RulesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "indx", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString},
		{Name: "desc", Type: field.TypeString},
	}
	// RulesTable holds the schema information for the "rules" table.
	RulesTable = &schema.Table{
		Name:       "rules",
		Columns:    RulesColumns,
		PrimaryKey: []*schema.Column{RulesColumns[0]},
	}
	// RuleSectionsColumns holds the columns for the "rule_sections" table.
	RuleSectionsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "indx", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString},
		{Name: "desc", Type: field.TypeString},
	}
	// RuleSectionsTable holds the schema information for the "rule_sections" table.
	RuleSectionsTable = &schema.Table{
		Name:       "rule_sections",
		Columns:    RuleSectionsColumns,
		PrimaryKey: []*schema.Column{RuleSectionsColumns[0]},
	}
	// SkillsColumns holds the columns for the "skills" table.
	SkillsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "indx", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString},
		{Name: "desc", Type: field.TypeJSON},
		{Name: "proficiency_skill", Type: field.TypeInt, Nullable: true},
		{Name: "skill_ability_score", Type: field.TypeInt, Nullable: true},
	}
	// SkillsTable holds the schema information for the "skills" table.
	SkillsTable = &schema.Table{
		Name:       "skills",
		Columns:    SkillsColumns,
		PrimaryKey: []*schema.Column{SkillsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "skills_proficiencies_skill",
				Columns:    []*schema.Column{SkillsColumns[4]},
				RefColumns: []*schema.Column{ProficienciesColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "skills_ability_scores_ability_score",
				Columns:    []*schema.Column{SkillsColumns[5]},
				RefColumns: []*schema.Column{AbilityScoresColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// SubracesColumns holds the columns for the "subraces" table.
	SubracesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "indx", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString},
		{Name: "desc", Type: field.TypeString},
		{Name: "subrace_race", Type: field.TypeInt, Nullable: true},
	}
	// SubracesTable holds the schema information for the "subraces" table.
	SubracesTable = &schema.Table{
		Name:       "subraces",
		Columns:    SubracesColumns,
		PrimaryKey: []*schema.Column{SubracesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "subraces_races_race",
				Columns:    []*schema.Column{SubracesColumns[4]},
				RefColumns: []*schema.Column{RacesColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// ToolsColumns holds the columns for the "tools" table.
	ToolsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "indx", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString},
		{Name: "tool_category", Type: field.TypeString},
		{Name: "equipment_id", Type: field.TypeInt, Unique: true},
	}
	// ToolsTable holds the schema information for the "tools" table.
	ToolsTable = &schema.Table{
		Name:       "tools",
		Columns:    ToolsColumns,
		PrimaryKey: []*schema.Column{ToolsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "tools_equipment_tool",
				Columns:    []*schema.Column{ToolsColumns[4]},
				RefColumns: []*schema.Column{EquipmentColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
	}
	// TraitsColumns holds the columns for the "traits" table.
	TraitsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "indx", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString},
		{Name: "desc", Type: field.TypeJSON},
	}
	// TraitsTable holds the schema information for the "traits" table.
	TraitsTable = &schema.Table{
		Name:       "traits",
		Columns:    TraitsColumns,
		PrimaryKey: []*schema.Column{TraitsColumns[0]},
	}
	// VehiclesColumns holds the columns for the "vehicles" table.
	VehiclesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "indx", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString},
		{Name: "vehicle_category", Type: field.TypeString},
		{Name: "capacity", Type: field.TypeString},
		{Name: "equipment_id", Type: field.TypeInt, Unique: true},
	}
	// VehiclesTable holds the schema information for the "vehicles" table.
	VehiclesTable = &schema.Table{
		Name:       "vehicles",
		Columns:    VehiclesColumns,
		PrimaryKey: []*schema.Column{VehiclesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "vehicles_equipment_vehicle",
				Columns:    []*schema.Column{VehiclesColumns[5]},
				RefColumns: []*schema.Column{EquipmentColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
	}
	// WeaponsColumns holds the columns for the "weapons" table.
	WeaponsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "indx", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString},
		{Name: "weapon_category", Type: field.TypeString},
		{Name: "weapon_range", Type: field.TypeString},
		{Name: "equipment_id", Type: field.TypeInt, Unique: true},
	}
	// WeaponsTable holds the schema information for the "weapons" table.
	WeaponsTable = &schema.Table{
		Name:       "weapons",
		Columns:    WeaponsColumns,
		PrimaryKey: []*schema.Column{WeaponsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "weapons_equipment_weapon",
				Columns:    []*schema.Column{WeaponsColumns[5]},
				RefColumns: []*schema.Column{EquipmentColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
	}
	// WeaponDamagesColumns holds the columns for the "weapon_damages" table.
	WeaponDamagesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "dice", Type: field.TypeString},
		{Name: "weapon_id", Type: field.TypeInt},
		{Name: "damage_type_id", Type: field.TypeInt},
	}
	// WeaponDamagesTable holds the schema information for the "weapon_damages" table.
	WeaponDamagesTable = &schema.Table{
		Name:       "weapon_damages",
		Columns:    WeaponDamagesColumns,
		PrimaryKey: []*schema.Column{WeaponDamagesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "weapon_damages_weapons_weapon_damage",
				Columns:    []*schema.Column{WeaponDamagesColumns[2]},
				RefColumns: []*schema.Column{WeaponsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "weapon_damages_damage_types_damage_type",
				Columns:    []*schema.Column{WeaponDamagesColumns[3]},
				RefColumns: []*schema.Column{DamageTypesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
	}
	// WeaponPropertiesColumns holds the columns for the "weapon_properties" table.
	WeaponPropertiesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "indx", Type: field.TypeString, Unique: true},
		{Name: "name", Type: field.TypeString},
		{Name: "desc", Type: field.TypeJSON},
	}
	// WeaponPropertiesTable holds the schema information for the "weapon_properties" table.
	WeaponPropertiesTable = &schema.Table{
		Name:       "weapon_properties",
		Columns:    WeaponPropertiesColumns,
		PrimaryKey: []*schema.Column{WeaponPropertiesColumns[0]},
	}
	// ClassProficienciesColumns holds the columns for the "class_proficiencies" table.
	ClassProficienciesColumns = []*schema.Column{
		{Name: "class_id", Type: field.TypeInt},
		{Name: "proficiency_id", Type: field.TypeInt},
	}
	// ClassProficienciesTable holds the schema information for the "class_proficiencies" table.
	ClassProficienciesTable = &schema.Table{
		Name:       "class_proficiencies",
		Columns:    ClassProficienciesColumns,
		PrimaryKey: []*schema.Column{ClassProficienciesColumns[0], ClassProficienciesColumns[1]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "class_proficiencies_class_id",
				Columns:    []*schema.Column{ClassProficienciesColumns[0]},
				RefColumns: []*schema.Column{ClassesColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "class_proficiencies_proficiency_id",
				Columns:    []*schema.Column{ClassProficienciesColumns[1]},
				RefColumns: []*schema.Column{ProficienciesColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// ClassProficiencyChoicesColumns holds the columns for the "class_proficiency_choices" table.
	ClassProficiencyChoicesColumns = []*schema.Column{
		{Name: "class_id", Type: field.TypeInt},
		{Name: "proficiency_choice_id", Type: field.TypeInt},
	}
	// ClassProficiencyChoicesTable holds the schema information for the "class_proficiency_choices" table.
	ClassProficiencyChoicesTable = &schema.Table{
		Name:       "class_proficiency_choices",
		Columns:    ClassProficiencyChoicesColumns,
		PrimaryKey: []*schema.Column{ClassProficiencyChoicesColumns[0], ClassProficiencyChoicesColumns[1]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "class_proficiency_choices_class_id",
				Columns:    []*schema.Column{ClassProficiencyChoicesColumns[0]},
				RefColumns: []*schema.Column{ClassesColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "class_proficiency_choices_proficiency_choice_id",
				Columns:    []*schema.Column{ClassProficiencyChoicesColumns[1]},
				RefColumns: []*schema.Column{ProficiencyChoicesColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// ClassEquipmentChoicesColumns holds the columns for the "class_equipment_choices" table.
	ClassEquipmentChoicesColumns = []*schema.Column{
		{Name: "class_id", Type: field.TypeInt},
		{Name: "equipment_choice_id", Type: field.TypeInt},
	}
	// ClassEquipmentChoicesTable holds the schema information for the "class_equipment_choices" table.
	ClassEquipmentChoicesTable = &schema.Table{
		Name:       "class_equipment_choices",
		Columns:    ClassEquipmentChoicesColumns,
		PrimaryKey: []*schema.Column{ClassEquipmentChoicesColumns[0], ClassEquipmentChoicesColumns[1]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "class_equipment_choices_class_id",
				Columns:    []*schema.Column{ClassEquipmentChoicesColumns[0]},
				RefColumns: []*schema.Column{ClassesColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "class_equipment_choices_equipment_choice_id",
				Columns:    []*schema.Column{ClassEquipmentChoicesColumns[1]},
				RefColumns: []*schema.Column{EquipmentChoicesColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// EquipmentCategoryEquipmentColumns holds the columns for the "equipment_category_equipment" table.
	EquipmentCategoryEquipmentColumns = []*schema.Column{
		{Name: "equipment_category_id", Type: field.TypeInt},
		{Name: "equipment_id", Type: field.TypeInt},
	}
	// EquipmentCategoryEquipmentTable holds the schema information for the "equipment_category_equipment" table.
	EquipmentCategoryEquipmentTable = &schema.Table{
		Name:       "equipment_category_equipment",
		Columns:    EquipmentCategoryEquipmentColumns,
		PrimaryKey: []*schema.Column{EquipmentCategoryEquipmentColumns[0], EquipmentCategoryEquipmentColumns[1]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "equipment_category_equipment_equipment_category_id",
				Columns:    []*schema.Column{EquipmentCategoryEquipmentColumns[0]},
				RefColumns: []*schema.Column{EquipmentCategoriesColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "equipment_category_equipment_equipment_id",
				Columns:    []*schema.Column{EquipmentCategoryEquipmentColumns[1]},
				RefColumns: []*schema.Column{EquipmentColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// EquipmentChoiceEquipmentColumns holds the columns for the "equipment_choice_equipment" table.
	EquipmentChoiceEquipmentColumns = []*schema.Column{
		{Name: "equipment_choice_id", Type: field.TypeInt},
		{Name: "equipment_id", Type: field.TypeInt},
	}
	// EquipmentChoiceEquipmentTable holds the schema information for the "equipment_choice_equipment" table.
	EquipmentChoiceEquipmentTable = &schema.Table{
		Name:       "equipment_choice_equipment",
		Columns:    EquipmentChoiceEquipmentColumns,
		PrimaryKey: []*schema.Column{EquipmentChoiceEquipmentColumns[0], EquipmentChoiceEquipmentColumns[1]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "equipment_choice_equipment_equipment_choice_id",
				Columns:    []*schema.Column{EquipmentChoiceEquipmentColumns[0]},
				RefColumns: []*schema.Column{EquipmentChoicesColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "equipment_choice_equipment_equipment_id",
				Columns:    []*schema.Column{EquipmentChoiceEquipmentColumns[1]},
				RefColumns: []*schema.Column{EquipmentColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// ProficiencyChoiceColumns holds the columns for the "proficiency_choice" table.
	ProficiencyChoiceColumns = []*schema.Column{
		{Name: "proficiency_id", Type: field.TypeInt},
		{Name: "proficiency_choice_id", Type: field.TypeInt},
	}
	// ProficiencyChoiceTable holds the schema information for the "proficiency_choice" table.
	ProficiencyChoiceTable = &schema.Table{
		Name:       "proficiency_choice",
		Columns:    ProficiencyChoiceColumns,
		PrimaryKey: []*schema.Column{ProficiencyChoiceColumns[0], ProficiencyChoiceColumns[1]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "proficiency_choice_proficiency_id",
				Columns:    []*schema.Column{ProficiencyChoiceColumns[0]},
				RefColumns: []*schema.Column{ProficienciesColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "proficiency_choice_proficiency_choice_id",
				Columns:    []*schema.Column{ProficiencyChoiceColumns[1]},
				RefColumns: []*schema.Column{ProficiencyChoicesColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// RaceProficienciesColumns holds the columns for the "race_proficiencies" table.
	RaceProficienciesColumns = []*schema.Column{
		{Name: "race_id", Type: field.TypeInt},
		{Name: "proficiency_id", Type: field.TypeInt},
	}
	// RaceProficienciesTable holds the schema information for the "race_proficiencies" table.
	RaceProficienciesTable = &schema.Table{
		Name:       "race_proficiencies",
		Columns:    RaceProficienciesColumns,
		PrimaryKey: []*schema.Column{RaceProficienciesColumns[0], RaceProficienciesColumns[1]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "race_proficiencies_race_id",
				Columns:    []*schema.Column{RaceProficienciesColumns[0]},
				RefColumns: []*schema.Column{RacesColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "race_proficiencies_proficiency_id",
				Columns:    []*schema.Column{RaceProficienciesColumns[1]},
				RefColumns: []*schema.Column{ProficienciesColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// RaceProficiencyChoiceColumns holds the columns for the "race_proficiency_choice" table.
	RaceProficiencyChoiceColumns = []*schema.Column{
		{Name: "race_id", Type: field.TypeInt},
		{Name: "proficiency_choice_id", Type: field.TypeInt},
	}
	// RaceProficiencyChoiceTable holds the schema information for the "race_proficiency_choice" table.
	RaceProficiencyChoiceTable = &schema.Table{
		Name:       "race_proficiency_choice",
		Columns:    RaceProficiencyChoiceColumns,
		PrimaryKey: []*schema.Column{RaceProficiencyChoiceColumns[0], RaceProficiencyChoiceColumns[1]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "race_proficiency_choice_race_id",
				Columns:    []*schema.Column{RaceProficiencyChoiceColumns[0]},
				RefColumns: []*schema.Column{RacesColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "race_proficiency_choice_proficiency_choice_id",
				Columns:    []*schema.Column{RaceProficiencyChoiceColumns[1]},
				RefColumns: []*schema.Column{ProficiencyChoicesColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// RaceLanguagesColumns holds the columns for the "race_languages" table.
	RaceLanguagesColumns = []*schema.Column{
		{Name: "race_id", Type: field.TypeInt},
		{Name: "language_id", Type: field.TypeInt},
	}
	// RaceLanguagesTable holds the schema information for the "race_languages" table.
	RaceLanguagesTable = &schema.Table{
		Name:       "race_languages",
		Columns:    RaceLanguagesColumns,
		PrimaryKey: []*schema.Column{RaceLanguagesColumns[0], RaceLanguagesColumns[1]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "race_languages_race_id",
				Columns:    []*schema.Column{RaceLanguagesColumns[0]},
				RefColumns: []*schema.Column{RacesColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "race_languages_language_id",
				Columns:    []*schema.Column{RaceLanguagesColumns[1]},
				RefColumns: []*schema.Column{LanguagesColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// RaceTraitsColumns holds the columns for the "race_traits" table.
	RaceTraitsColumns = []*schema.Column{
		{Name: "race_id", Type: field.TypeInt},
		{Name: "trait_id", Type: field.TypeInt},
	}
	// RaceTraitsTable holds the schema information for the "race_traits" table.
	RaceTraitsTable = &schema.Table{
		Name:       "race_traits",
		Columns:    RaceTraitsColumns,
		PrimaryKey: []*schema.Column{RaceTraitsColumns[0], RaceTraitsColumns[1]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "race_traits_race_id",
				Columns:    []*schema.Column{RaceTraitsColumns[0]},
				RefColumns: []*schema.Column{RacesColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "race_traits_trait_id",
				Columns:    []*schema.Column{RaceTraitsColumns[1]},
				RefColumns: []*schema.Column{TraitsColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// RuleRuleSectionsColumns holds the columns for the "rule_rule_sections" table.
	RuleRuleSectionsColumns = []*schema.Column{
		{Name: "rule_id", Type: field.TypeInt},
		{Name: "rule_section_id", Type: field.TypeInt},
	}
	// RuleRuleSectionsTable holds the schema information for the "rule_rule_sections" table.
	RuleRuleSectionsTable = &schema.Table{
		Name:       "rule_rule_sections",
		Columns:    RuleRuleSectionsColumns,
		PrimaryKey: []*schema.Column{RuleRuleSectionsColumns[0], RuleRuleSectionsColumns[1]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "rule_rule_sections_rule_id",
				Columns:    []*schema.Column{RuleRuleSectionsColumns[0]},
				RefColumns: []*schema.Column{RulesColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "rule_rule_sections_rule_section_id",
				Columns:    []*schema.Column{RuleRuleSectionsColumns[1]},
				RefColumns: []*schema.Column{RuleSectionsColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// SubraceProficienciesColumns holds the columns for the "subrace_proficiencies" table.
	SubraceProficienciesColumns = []*schema.Column{
		{Name: "subrace_id", Type: field.TypeInt},
		{Name: "proficiency_id", Type: field.TypeInt},
	}
	// SubraceProficienciesTable holds the schema information for the "subrace_proficiencies" table.
	SubraceProficienciesTable = &schema.Table{
		Name:       "subrace_proficiencies",
		Columns:    SubraceProficienciesColumns,
		PrimaryKey: []*schema.Column{SubraceProficienciesColumns[0], SubraceProficienciesColumns[1]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "subrace_proficiencies_subrace_id",
				Columns:    []*schema.Column{SubraceProficienciesColumns[0]},
				RefColumns: []*schema.Column{SubracesColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "subrace_proficiencies_proficiency_id",
				Columns:    []*schema.Column{SubraceProficienciesColumns[1]},
				RefColumns: []*schema.Column{ProficienciesColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// SubraceTraitsColumns holds the columns for the "subrace_traits" table.
	SubraceTraitsColumns = []*schema.Column{
		{Name: "subrace_id", Type: field.TypeInt},
		{Name: "trait_id", Type: field.TypeInt},
	}
	// SubraceTraitsTable holds the schema information for the "subrace_traits" table.
	SubraceTraitsTable = &schema.Table{
		Name:       "subrace_traits",
		Columns:    SubraceTraitsColumns,
		PrimaryKey: []*schema.Column{SubraceTraitsColumns[0], SubraceTraitsColumns[1]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "subrace_traits_subrace_id",
				Columns:    []*schema.Column{SubraceTraitsColumns[0]},
				RefColumns: []*schema.Column{SubracesColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "subrace_traits_trait_id",
				Columns:    []*schema.Column{SubraceTraitsColumns[1]},
				RefColumns: []*schema.Column{TraitsColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// WeaponWeaponPropertiesColumns holds the columns for the "weapon_weapon_properties" table.
	WeaponWeaponPropertiesColumns = []*schema.Column{
		{Name: "weapon_id", Type: field.TypeInt},
		{Name: "weapon_property_id", Type: field.TypeInt},
	}
	// WeaponWeaponPropertiesTable holds the schema information for the "weapon_weapon_properties" table.
	WeaponWeaponPropertiesTable = &schema.Table{
		Name:       "weapon_weapon_properties",
		Columns:    WeaponWeaponPropertiesColumns,
		PrimaryKey: []*schema.Column{WeaponWeaponPropertiesColumns[0], WeaponWeaponPropertiesColumns[1]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "weapon_weapon_properties_weapon_id",
				Columns:    []*schema.Column{WeaponWeaponPropertiesColumns[0]},
				RefColumns: []*schema.Column{WeaponsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "weapon_weapon_properties_weapon_property_id",
				Columns:    []*schema.Column{WeaponWeaponPropertiesColumns[1]},
				RefColumns: []*schema.Column{WeaponPropertiesColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// Tables holds all the tables in the schema.
	Tables = []*schema.Table{
		AbilityBonusTable,
		AbilityScoresTable,
		ArmorsTable,
		ArmorClassesTable,
		ClassesTable,
		ClassEquipmentsTable,
		CoinsTable,
		DamageTypesTable,
		EquipmentTable,
		EquipmentCategoriesTable,
		EquipmentChoicesTable,
		EquipmentCostsTable,
		GearsTable,
		LanguagesTable,
		MagicSchoolsTable,
		ProficienciesTable,
		ProficiencyChoicesTable,
		RacesTable,
		RulesTable,
		RuleSectionsTable,
		SkillsTable,
		SubracesTable,
		ToolsTable,
		TraitsTable,
		VehiclesTable,
		WeaponsTable,
		WeaponDamagesTable,
		WeaponPropertiesTable,
		ClassProficienciesTable,
		ClassProficiencyChoicesTable,
		ClassEquipmentChoicesTable,
		EquipmentCategoryEquipmentTable,
		EquipmentChoiceEquipmentTable,
		ProficiencyChoiceTable,
		RaceProficienciesTable,
		RaceProficiencyChoiceTable,
		RaceLanguagesTable,
		RaceTraitsTable,
		RuleRuleSectionsTable,
		SubraceProficienciesTable,
		SubraceTraitsTable,
		WeaponWeaponPropertiesTable,
	}
)

Functions

func Create

func Create(ctx context.Context, s *Schema, tables []*schema.Table, opts ...schema.MigrateOption) error

Create creates all table resources using the given schema driver.

Types

type Schema

type Schema struct {
	// contains filtered or unexported fields
}

Schema is the API for creating, migrating and dropping a schema.

func NewSchema

func NewSchema(drv dialect.Driver) *Schema

NewSchema creates a new schema client.

func (*Schema) Create

func (s *Schema) Create(ctx context.Context, opts ...schema.MigrateOption) error

Create creates all schema resources.

func (*Schema) WriteTo

func (s *Schema) WriteTo(ctx context.Context, w io.Writer, opts ...schema.MigrateOption) error

WriteTo writes the schema changes to w instead of running them against the database.

if err := client.Schema.WriteTo(context.Background(), os.Stdout); err != nil {
	log.Fatal(err)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL