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: "bonus", Type: field.TypeInt}, {Name: "race_id", Type: field.TypeInt}, {Name: "ability_score_id", Type: field.TypeInt}, } // AbilityBonusTable holds the schema information for the "ability_bonus" table. AbilityBonusTable = &schema.Table{ Name: "ability_bonus", Columns: AbilityBonusColumns, PrimaryKey: []*schema.Column{AbilityBonusColumns[1], AbilityBonusColumns[2]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "ability_bonus_races_race", Columns: []*schema.Column{AbilityBonusColumns[1]}, RefColumns: []*schema.Column{RacesColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "ability_bonus_ability_scores_ability_score", Columns: []*schema.Column{AbilityBonusColumns[2]}, RefColumns: []*schema.Column{AbilityScoresColumns[0]}, OnDelete: schema.NoAction, }, }, } // 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: "desc", Type: field.TypeJSON, Nullable: true}, {Name: "full_name", Type: field.TypeString}, } // AbilityScoresTable holds the schema information for the "ability_scores" table. AbilityScoresTable = &schema.Table{ Name: "ability_scores", Columns: AbilityScoresColumns, PrimaryKey: []*schema.Column{AbilityScoresColumns[0]}, } // AlignmentsColumns holds the columns for the "alignments" table. AlignmentsColumns = []*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, Nullable: true}, {Name: "abbr", Type: field.TypeEnum, Enums: []string{"LG", "NG", "CG", "LN", "N", "CN", "LE", "NE", "CE"}}, } // AlignmentsTable holds the schema information for the "alignments" table. AlignmentsTable = &schema.Table{ Name: "alignments", Columns: AlignmentsColumns, PrimaryKey: []*schema.Column{AlignmentsColumns[0]}, } // ArmorsColumns holds the columns for the "armors" table. ArmorsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "armor_category", Type: field.TypeEnum, Enums: []string{"light", "medium", "heavy", "shield"}}, {Name: "str_minimum", Type: field.TypeInt}, {Name: "stealth_disadvantage", Type: field.TypeBool}, {Name: "ac_base", Type: field.TypeInt}, {Name: "ac_dex_bonus", Type: field.TypeBool, Default: false}, {Name: "ac_max_bonus", Type: field.TypeInt, Default: 0}, {Name: "equipment_armor", 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[7]}, RefColumns: []*schema.Column{EquipmentColumns[0]}, OnDelete: schema.NoAction, }, }, } // CharactersColumns holds the columns for the "characters" table. CharactersColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "name", Type: field.TypeString}, {Name: "age", Type: field.TypeInt, Default: 25}, {Name: "level", Type: field.TypeInt, Default: 1}, {Name: "proficiency_bonus", Type: field.TypeInt, Default: 2}, {Name: "character_race", Type: field.TypeInt, Nullable: true}, {Name: "character_class", Type: field.TypeInt, Nullable: true}, {Name: "character_alignment", Type: field.TypeInt, Nullable: true}, } // CharactersTable holds the schema information for the "characters" table. CharactersTable = &schema.Table{ Name: "characters", Columns: CharactersColumns, PrimaryKey: []*schema.Column{CharactersColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "characters_races_race", Columns: []*schema.Column{CharactersColumns[5]}, RefColumns: []*schema.Column{RacesColumns[0]}, OnDelete: schema.SetNull, }, { Symbol: "characters_classes_class", Columns: []*schema.Column{CharactersColumns[6]}, RefColumns: []*schema.Column{ClassesColumns[0]}, OnDelete: schema.SetNull, }, { Symbol: "characters_alignments_alignment", Columns: []*schema.Column{CharactersColumns[7]}, RefColumns: []*schema.Column{AlignmentsColumns[0]}, OnDelete: schema.SetNull, }, }, } // CharacterAbilityScoresColumns holds the columns for the "character_ability_scores" table. CharacterAbilityScoresColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "score", Type: field.TypeInt}, {Name: "modifier", Type: field.TypeInt}, {Name: "character_character_ability_scores", Type: field.TypeInt}, {Name: "character_ability_score_ability_score", Type: field.TypeInt}, } // CharacterAbilityScoresTable holds the schema information for the "character_ability_scores" table. CharacterAbilityScoresTable = &schema.Table{ Name: "character_ability_scores", Columns: CharacterAbilityScoresColumns, PrimaryKey: []*schema.Column{CharacterAbilityScoresColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "character_ability_scores_characters_character_ability_scores", Columns: []*schema.Column{CharacterAbilityScoresColumns[3]}, RefColumns: []*schema.Column{CharactersColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "character_ability_scores_ability_scores_ability_score", Columns: []*schema.Column{CharacterAbilityScoresColumns[4]}, RefColumns: []*schema.Column{AbilityScoresColumns[0]}, OnDelete: schema.NoAction, }, }, } // CharacterProficienciesColumns holds the columns for the "character_proficiencies" table. CharacterProficienciesColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "proficiency_type", Type: field.TypeEnum, Enums: []string{"SKILL", "EQUIPMENT", "EQUIPMENT_CATEGORY", "SAVING_THROW", "OTHER"}}, {Name: "proficiency_source", Type: field.TypeEnum, Enums: []string{"CLASS_PROFICIENCY", "RACE_PROFICIENCY", "CLASS_CHOICE", "RACE_CHOICE", "OTHER"}}, {Name: "character_character_proficiencies", Type: field.TypeInt}, {Name: "character_proficiency_proficiency", Type: field.TypeInt}, {Name: "character_skill_character_proficiency", Type: field.TypeInt, Unique: true, Nullable: true}, } // CharacterProficienciesTable holds the schema information for the "character_proficiencies" table. CharacterProficienciesTable = &schema.Table{ Name: "character_proficiencies", Columns: CharacterProficienciesColumns, PrimaryKey: []*schema.Column{CharacterProficienciesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "character_proficiencies_characters_character_proficiencies", Columns: []*schema.Column{CharacterProficienciesColumns[3]}, RefColumns: []*schema.Column{CharactersColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "character_proficiencies_proficiencies_proficiency", Columns: []*schema.Column{CharacterProficienciesColumns[4]}, RefColumns: []*schema.Column{ProficienciesColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "character_proficiencies_character_skills_character_proficiency", Columns: []*schema.Column{CharacterProficienciesColumns[5]}, RefColumns: []*schema.Column{CharacterSkillsColumns[0]}, OnDelete: schema.SetNull, }, }, } // CharacterSkillsColumns holds the columns for the "character_skills" table. CharacterSkillsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "proficient", Type: field.TypeBool, Default: false}, {Name: "character_character_skills", Type: field.TypeInt}, {Name: "character_skill_skill", Type: field.TypeInt}, {Name: "character_skill_character_ability_score", Type: field.TypeInt}, } // CharacterSkillsTable holds the schema information for the "character_skills" table. CharacterSkillsTable = &schema.Table{ Name: "character_skills", Columns: CharacterSkillsColumns, PrimaryKey: []*schema.Column{CharacterSkillsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "character_skills_characters_character_skills", Columns: []*schema.Column{CharacterSkillsColumns[2]}, RefColumns: []*schema.Column{CharactersColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "character_skills_skills_skill", Columns: []*schema.Column{CharacterSkillsColumns[3]}, RefColumns: []*schema.Column{SkillsColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "character_skills_character_ability_scores_character_ability_score", Columns: []*schema.Column{CharacterSkillsColumns[4]}, RefColumns: []*schema.Column{CharacterAbilityScoresColumns[0]}, OnDelete: schema.NoAction, }, }, } // 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]}, } // 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: "name", Type: field.TypeString}, {Name: "desc", Type: field.TypeJSON, Nullable: true}, {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]}, } // ConditionsColumns holds the columns for the "conditions" table. ConditionsColumns = []*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, Nullable: true}, } // ConditionsTable holds the schema information for the "conditions" table. ConditionsTable = &schema.Table{ Name: "conditions", Columns: ConditionsColumns, PrimaryKey: []*schema.Column{ConditionsColumns[0]}, } // CostsColumns holds the columns for the "costs" table. CostsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "quantity", Type: field.TypeInt, Default: 1}, {Name: "cost_coin", Type: field.TypeInt}, {Name: "equipment_cost", Type: field.TypeInt, Unique: true, Nullable: true}, } // CostsTable holds the schema information for the "costs" table. CostsTable = &schema.Table{ Name: "costs", Columns: CostsColumns, PrimaryKey: []*schema.Column{CostsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "costs_coins_coin", Columns: []*schema.Column{CostsColumns[2]}, RefColumns: []*schema.Column{CoinsColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "costs_equipment_cost", Columns: []*schema.Column{CostsColumns[3]}, RefColumns: []*schema.Column{EquipmentColumns[0]}, OnDelete: schema.SetNull, }, }, } // 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, Nullable: true}, } // 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: "equipment_category", Type: field.TypeEnum, Enums: []string{"GEAR", "TOOL", "WEAPON", "VEHICLE", "ARMOR"}}, {Name: "weight", Type: field.TypeFloat64, Nullable: true}, } // EquipmentTable holds the schema information for the "equipment" table. EquipmentTable = &schema.Table{ Name: "equipment", Columns: EquipmentColumns, PrimaryKey: []*schema.Column{EquipmentColumns[0]}, } // EquipmentEntriesColumns holds the columns for the "equipment_entries" table. EquipmentEntriesColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "quantity", Type: field.TypeInt}, {Name: "equipment_entry_equipment", Type: field.TypeInt}, } // EquipmentEntriesTable holds the schema information for the "equipment_entries" table. EquipmentEntriesTable = &schema.Table{ Name: "equipment_entries", Columns: EquipmentEntriesColumns, PrimaryKey: []*schema.Column{EquipmentEntriesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "equipment_entries_equipment_equipment", Columns: []*schema.Column{EquipmentEntriesColumns[2]}, RefColumns: []*schema.Column{EquipmentColumns[0]}, OnDelete: schema.NoAction, }, }, } // FeatsColumns holds the columns for the "feats" table. FeatsColumns = []*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, Nullable: true}, } // FeatsTable holds the schema information for the "feats" table. FeatsTable = &schema.Table{ Name: "feats", Columns: FeatsColumns, PrimaryKey: []*schema.Column{FeatsColumns[0]}, } // FeaturesColumns holds the columns for the "features" table. FeaturesColumns = []*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, Nullable: true}, {Name: "level", Type: field.TypeInt}, } // FeaturesTable holds the schema information for the "features" table. FeaturesTable = &schema.Table{ Name: "features", Columns: FeaturesColumns, PrimaryKey: []*schema.Column{FeaturesColumns[0]}, } // GearsColumns holds the columns for the "gears" table. GearsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "gear_category", Type: field.TypeString}, {Name: "desc", Type: field.TypeJSON, Nullable: true}, {Name: "equipment_gear", 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[3]}, 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.TypeJSON, Nullable: true}, {Name: "language_type", Type: field.TypeEnum, Enums: []string{"STANDARD", "EXOTIC"}, Default: "STANDARD"}, {Name: "script", Type: field.TypeEnum, 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]}, } // LanguageChoicesColumns holds the columns for the "language_choices" table. LanguageChoicesColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "choose", Type: field.TypeInt}, {Name: "race_language_options", Type: field.TypeInt, Unique: true, Nullable: true}, } // LanguageChoicesTable holds the schema information for the "language_choices" table. LanguageChoicesTable = &schema.Table{ Name: "language_choices", Columns: LanguageChoicesColumns, PrimaryKey: []*schema.Column{LanguageChoicesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "language_choices_races_language_options", Columns: []*schema.Column{LanguageChoicesColumns[2]}, RefColumns: []*schema.Column{RacesColumns[0]}, OnDelete: schema.SetNull, }, }, } // 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.TypeJSON, Nullable: true}, } // MagicSchoolsTable holds the schema information for the "magic_schools" table. MagicSchoolsTable = &schema.Table{ Name: "magic_schools", Columns: MagicSchoolsColumns, PrimaryKey: []*schema.Column{MagicSchoolsColumns[0]}, } // PrerequisitesColumns holds the columns for the "prerequisites" table. PrerequisitesColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "prerequisite_type", Type: field.TypeEnum, Enums: []string{"level", "spell", "feature"}}, {Name: "level_value", Type: field.TypeInt, Nullable: true}, {Name: "feature_value", Type: field.TypeString, Nullable: true}, {Name: "spell_value", Type: field.TypeString, Nullable: true}, {Name: "feature_prerequisites", Type: field.TypeInt, Nullable: true}, } // PrerequisitesTable holds the schema information for the "prerequisites" table. PrerequisitesTable = &schema.Table{ Name: "prerequisites", Columns: PrerequisitesColumns, PrimaryKey: []*schema.Column{PrerequisitesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "prerequisites_features_prerequisites", Columns: []*schema.Column{PrerequisitesColumns[5]}, RefColumns: []*schema.Column{FeaturesColumns[0]}, OnDelete: schema.SetNull, }, }, } // 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: "reference", 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.TypeJSON}, {Name: "class_proficiency_options", Type: field.TypeInt, Nullable: true}, {Name: "race_starting_proficiency_options", 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_classes_proficiency_options", Columns: []*schema.Column{ProficiencyChoicesColumns[3]}, RefColumns: []*schema.Column{ClassesColumns[0]}, OnDelete: schema.SetNull, }, { Symbol: "proficiency_choices_races_starting_proficiency_options", Columns: []*schema.Column{ProficiencyChoicesColumns[4]}, RefColumns: []*schema.Column{RacesColumns[0]}, OnDelete: schema.SetNull, }, }, } // PropertiesColumns holds the columns for the "properties" table. PropertiesColumns = []*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, Nullable: true}, } // PropertiesTable holds the schema information for the "properties" table. PropertiesTable = &schema.Table{ Name: "properties", Columns: PropertiesColumns, PrimaryKey: []*schema.Column{PropertiesColumns[0]}, } // 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: "speed", Type: field.TypeInt}, {Name: "size", Type: field.TypeEnum, Enums: []string{"Small", "Medium", "Large"}, Default: "Medium"}, {Name: "size_desc", Type: field.TypeString}, {Name: "alignment_desc", Type: field.TypeString}, {Name: "age_desc", Type: field.TypeString}, {Name: "language_desc", Type: field.TypeString}, } // 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.TypeJSON, Nullable: true}, } // 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.TypeJSON, Nullable: true}, {Name: "rule_id", Type: field.TypeInt, Nullable: true}, } // RuleSectionsTable holds the schema information for the "rule_sections" table. RuleSectionsTable = &schema.Table{ Name: "rule_sections", Columns: RuleSectionsColumns, PrimaryKey: []*schema.Column{RuleSectionsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "rule_sections_rules_sections", Columns: []*schema.Column{RuleSectionsColumns[4]}, RefColumns: []*schema.Column{RulesColumns[0]}, OnDelete: schema.SetNull, }, }, } // 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, Nullable: true}, {Name: "ability_score_skills", 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_ability_scores_skills", Columns: []*schema.Column{SkillsColumns[4]}, RefColumns: []*schema.Column{AbilityScoresColumns[0]}, OnDelete: schema.SetNull, }, }, } // ToolsColumns holds the columns for the "tools" table. ToolsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "tool_category", Type: field.TypeString}, {Name: "desc", Type: field.TypeJSON, Nullable: true}, {Name: "equipment_tool", 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[3]}, 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, Nullable: true}, } // 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: "vehicle_category", Type: field.TypeEnum, Enums: []string{"mounts_and_other_animals", "tack_harness_and_drawn_vehicles", "waterborne"}}, {Name: "capacity", Type: field.TypeString, Nullable: true}, {Name: "desc", Type: field.TypeJSON, Nullable: true}, {Name: "speed_quantity", Type: field.TypeFloat64, Nullable: true}, {Name: "speed_units", Type: field.TypeEnum, Nullable: true, Enums: []string{"miles_per_hour", "feet_per_round"}}, {Name: "equipment_vehicle", 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[6]}, 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: "weapon_category", Type: field.TypeEnum, Enums: []string{"simple", "martial", "exotic", "other"}}, {Name: "weapon_subcategory", Type: field.TypeEnum, Enums: []string{"melee", "ranged", "other"}}, {Name: "range_normal", Type: field.TypeInt, Nullable: true}, {Name: "range_long", Type: field.TypeInt, Nullable: true}, {Name: "throw_range_normal", Type: field.TypeInt, Nullable: true}, {Name: "throw_range_long", Type: field.TypeInt, Nullable: true}, {Name: "damage_dice", Type: field.TypeString, Nullable: true}, {Name: "equipment_weapon", Type: field.TypeInt, Unique: true}, {Name: "weapon_damage_type", Type: field.TypeInt, Nullable: 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[8]}, RefColumns: []*schema.Column{EquipmentColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "weapons_damage_types_damage_type", Columns: []*schema.Column{WeaponsColumns[9]}, RefColumns: []*schema.Column{DamageTypesColumns[0]}, OnDelete: schema.SetNull, }, }, } // 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, }, }, } // ClassStartingEquipmentColumns holds the columns for the "class_starting_equipment" table. ClassStartingEquipmentColumns = []*schema.Column{ {Name: "class_id", Type: field.TypeInt}, {Name: "equipment_entry_id", Type: field.TypeInt}, } // ClassStartingEquipmentTable holds the schema information for the "class_starting_equipment" table. ClassStartingEquipmentTable = &schema.Table{ Name: "class_starting_equipment", Columns: ClassStartingEquipmentColumns, PrimaryKey: []*schema.Column{ClassStartingEquipmentColumns[0], ClassStartingEquipmentColumns[1]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "class_starting_equipment_class_id", Columns: []*schema.Column{ClassStartingEquipmentColumns[0]}, RefColumns: []*schema.Column{ClassesColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "class_starting_equipment_equipment_entry_id", Columns: []*schema.Column{ClassStartingEquipmentColumns[1]}, RefColumns: []*schema.Column{EquipmentEntriesColumns[0]}, OnDelete: schema.Cascade, }, }, } // ClassSavingThrowsColumns holds the columns for the "class_saving_throws" table. ClassSavingThrowsColumns = []*schema.Column{ {Name: "class_id", Type: field.TypeInt}, {Name: "ability_score_id", Type: field.TypeInt}, } // ClassSavingThrowsTable holds the schema information for the "class_saving_throws" table. ClassSavingThrowsTable = &schema.Table{ Name: "class_saving_throws", Columns: ClassSavingThrowsColumns, PrimaryKey: []*schema.Column{ClassSavingThrowsColumns[0], ClassSavingThrowsColumns[1]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "class_saving_throws_class_id", Columns: []*schema.Column{ClassSavingThrowsColumns[0]}, RefColumns: []*schema.Column{ClassesColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "class_saving_throws_ability_score_id", Columns: []*schema.Column{ClassSavingThrowsColumns[1]}, RefColumns: []*schema.Column{AbilityScoresColumns[0]}, OnDelete: schema.Cascade, }, }, } // LanguageChoiceLanguagesColumns holds the columns for the "language_choice_languages" table. LanguageChoiceLanguagesColumns = []*schema.Column{ {Name: "language_choice_id", Type: field.TypeInt}, {Name: "language_id", Type: field.TypeInt}, } // LanguageChoiceLanguagesTable holds the schema information for the "language_choice_languages" table. LanguageChoiceLanguagesTable = &schema.Table{ Name: "language_choice_languages", Columns: LanguageChoiceLanguagesColumns, PrimaryKey: []*schema.Column{LanguageChoiceLanguagesColumns[0], LanguageChoiceLanguagesColumns[1]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "language_choice_languages_language_choice_id", Columns: []*schema.Column{LanguageChoiceLanguagesColumns[0]}, RefColumns: []*schema.Column{LanguageChoicesColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "language_choice_languages_language_id", Columns: []*schema.Column{LanguageChoiceLanguagesColumns[1]}, RefColumns: []*schema.Column{LanguagesColumns[0]}, OnDelete: schema.Cascade, }, }, } // ProficiencyChoiceProficienciesColumns holds the columns for the "proficiency_choice_proficiencies" table. ProficiencyChoiceProficienciesColumns = []*schema.Column{ {Name: "proficiency_choice_id", Type: field.TypeInt}, {Name: "proficiency_id", Type: field.TypeInt}, } // ProficiencyChoiceProficienciesTable holds the schema information for the "proficiency_choice_proficiencies" table. ProficiencyChoiceProficienciesTable = &schema.Table{ Name: "proficiency_choice_proficiencies", Columns: ProficiencyChoiceProficienciesColumns, PrimaryKey: []*schema.Column{ProficiencyChoiceProficienciesColumns[0], ProficiencyChoiceProficienciesColumns[1]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "proficiency_choice_proficiencies_proficiency_choice_id", Columns: []*schema.Column{ProficiencyChoiceProficienciesColumns[0]}, RefColumns: []*schema.Column{ProficiencyChoicesColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "proficiency_choice_proficiencies_proficiency_id", Columns: []*schema.Column{ProficiencyChoiceProficienciesColumns[1]}, RefColumns: []*schema.Column{ProficienciesColumns[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, }, }, } // RaceStartingProficienciesColumns holds the columns for the "race_starting_proficiencies" table. RaceStartingProficienciesColumns = []*schema.Column{ {Name: "race_id", Type: field.TypeInt}, {Name: "proficiency_id", Type: field.TypeInt}, } // RaceStartingProficienciesTable holds the schema information for the "race_starting_proficiencies" table. RaceStartingProficienciesTable = &schema.Table{ Name: "race_starting_proficiencies", Columns: RaceStartingProficienciesColumns, PrimaryKey: []*schema.Column{RaceStartingProficienciesColumns[0], RaceStartingProficienciesColumns[1]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "race_starting_proficiencies_race_id", Columns: []*schema.Column{RaceStartingProficienciesColumns[0]}, RefColumns: []*schema.Column{RacesColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "race_starting_proficiencies_proficiency_id", Columns: []*schema.Column{RaceStartingProficienciesColumns[1]}, RefColumns: []*schema.Column{ProficienciesColumns[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, }, }, } // WeaponPropertiesColumns holds the columns for the "weapon_properties" table. WeaponPropertiesColumns = []*schema.Column{ {Name: "weapon_id", Type: field.TypeInt}, {Name: "property_id", Type: field.TypeInt}, } // WeaponPropertiesTable holds the schema information for the "weapon_properties" table. WeaponPropertiesTable = &schema.Table{ Name: "weapon_properties", Columns: WeaponPropertiesColumns, PrimaryKey: []*schema.Column{WeaponPropertiesColumns[0], WeaponPropertiesColumns[1]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "weapon_properties_weapon_id", Columns: []*schema.Column{WeaponPropertiesColumns[0]}, RefColumns: []*schema.Column{WeaponsColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "weapon_properties_property_id", Columns: []*schema.Column{WeaponPropertiesColumns[1]}, RefColumns: []*schema.Column{PropertiesColumns[0]}, OnDelete: schema.Cascade, }, }, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ AbilityBonusTable, AbilityScoresTable, AlignmentsTable, ArmorsTable, CharactersTable, CharacterAbilityScoresTable, CharacterProficienciesTable, CharacterSkillsTable, ClassesTable, CoinsTable, ConditionsTable, CostsTable, DamageTypesTable, EquipmentTable, EquipmentEntriesTable, FeatsTable, FeaturesTable, GearsTable, LanguagesTable, LanguageChoicesTable, MagicSchoolsTable, PrerequisitesTable, ProficienciesTable, ProficiencyChoicesTable, PropertiesTable, RacesTable, RulesTable, RuleSectionsTable, SkillsTable, ToolsTable, TraitsTable, VehiclesTable, WeaponsTable, ClassProficienciesTable, ClassStartingEquipmentTable, ClassSavingThrowsTable, LanguageChoiceLanguagesTable, ProficiencyChoiceProficienciesTable, RaceTraitsTable, RaceStartingProficienciesTable, RaceLanguagesTable, WeaponPropertiesTable, } )
Functions ¶
Types ¶
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
Schema is the API for creating, migrating and dropping a schema.
Click to show internal directories.
Click to hide internal directories.