{
  "databaseChangeLog": [
    {
      "changeSet": {
        "id": "Add units table",
        "author": "anibus",
        "changes": [
          {
            "createTable": {
              "tableName": "units",
              "columns": [
                {
                  "column": {
                    "name": "id",
                    "type": "int",
                    "autoIncrement": true,
                    "constraints": {
                      "primaryKey": true,
                      "nullable": false
                    }
                  }
                },
                {
                  "column": {
                    "name": "filename",
                    "type": "varchar(255)",
                    "constraints": {
                      "nullable": false
                    }
                  }
                },{
                  "column": {
                    "name": "name",
                    "type": "varchar(4096)"
                  }
                },{
                  "column": {
                    "name": "description",
                    "type": "varchar(5000)"
                  }
                },
                {
                  "column": {
                    "name": "build_cost_requisition",
                    "type": "number"
                  }
                },{
                  "column": {
                    "name": "build_cost_power",
                    "type": "number"
                  }
                },{
                  "column": {
                    "name": "build_cost_population",
                    "type": "number"
                  }
                },{
                  "column": {
                    "name": "build_cost_faith",
                    "type": "number"
                  }
                },{
                  "column": {
                    "name": "build_cost_souls",
                    "type": "number"
                  }
                },{
                  "column": {
                    "name": "build_cost_time",
                    "type": "int"
                  }
                },{
                  "column": {
                    "name": "cap_infantry",
                    "type": "int"
                  }
                },{
                  "column": {
                    "name": "cap_support",
                    "type": "int"
                  }
                },{
                  "column": {
                    "name": "squad_start_size",
                    "type": "int"
                  }
                },{
                  "column": {
                    "name": "squad_max_size",
                    "type": "int"
                  }
                },{
                  "column": {
                    "name": "squad_limit",
                    "type": "int"
                  }
                },{
                  "column": {
                    "name": "health",
                    "type": "int"
                  }
                },{
                  "column": {
                    "name": "health_regeneration",
                    "type": "number"
                  }
                },{
                  "column": {
                    "name": "race_id",
                    "type": "varchar(50)",
                    "constraints": {
                      "nullable":false
                    }
                  }
                },{
                  "column": {
                    "name": "armour_type_id",
                    "type": "varchar(50)",
                    "constraints": {
                      "nullable":false
                    }
                  }
                },{
                  "column": {
                    "name": "armour_type_2_id",
                    "type": "varchar(50)"
                  }
                },{
                  "column": {
                    "name": "morale_max",
                    "type": "int"
                  }
                },{
                  "column": {
                    "name": "morale_broken",
                    "type": "int"
                  }
                },{
                  "column": {
                    "name": "morale_regeneration",
                    "type": "int"
                  }
                },{
                  "column": {
                    "name": "morale_death_penalty",
                    "type": "int"
                  }
                },{
                  "column": {
                    "name": "mass",
                    "type": "int"
                  }
                },{
                  "column": {
                    "name": "up_time",
                    "type": "number"
                  }
                },{
                  "column": {
                    "name": "move_speed",
                    "type": "int"
                  }
                },{
                  "column": {
                    "name": "sight_radius",
                    "type": "int"
                  }
                },{
                  "column": {
                    "name": "detect_radius",
                    "type": "int"
                  }
                },{
                  "column": {
                    "name": "reinforce_cost_requisition",
                    "type": "int"
                  }
                },{
                  "column": {
                    "name": "reinforce_cost_power",
                    "type": "int"
                  }
                },{
                  "column": {
                    "name": "reinforce_cost_population",
                    "type": "int"
                  }
                },{
                  "column": {
                    "name": "reinforce_cost_faith",
                    "type": "int"
                  }
                },{
                  "column": {
                    "name": "reinforce_cost_souls",
                    "type": "number"
                  }
                },{
                  "column": {
                    "name": "reinforce_time",
                    "type": "int"
                  }
                },{
                  "column": {
                    "name": "max_sergeants",
                    "type": "int"
                  }
                },
                {
                  "column": {
                    "name": "mod_id",
                    "type": "int",
                    "constraints": {
                      "nullable": false
                    }
                  }
                },
                {
                  "column": {
                    "name": "icon",
                    "type": "varchar(128)"
                  }
                }
              ]
            }
          },
          {
            "addForeignKeyConstraint":
            {
              "baseColumnNames":  "race_id",
              "baseTableName":  "units",
              "constraintName":  "fk_units_races",
              "referencedColumnNames":  "id",
              "referencedTableName":  "races"
            }
          },
          {
            "addForeignKeyConstraint":
            {
              "baseColumnNames":  "armour_type_id",
              "baseTableName":  "units",
              "constraintName":  "fk_units_armor_types",
              "referencedColumnNames":  "id",
              "referencedTableName":  "armor_types"
            }
          },
          {
            "addForeignKeyConstraint":
            {
              "baseColumnNames":  "mod_id",
              "baseTableName":  "units",
              "constraintName":  "fk_units_mods",
              "referencedColumnNames":  "id",
              "referencedTableName":  "mods"
            }
          }
        ]
      }
    }
  ]
}
