{
  "User": {
    "tableName": "Users",
    "columns": {
      "id": {
        "columnName": "id",
        "type": "int",
        "primaryKey": true,
        "autoIncrement": true
      },
      "nick": {
        "columnName": "account",
        "type": "string",
        "length": 50,
        "allowNull": false
      },
      "passwordHash": {
        "columnName": "passwordHash",
        "type": "string",
        "length": 50
      },
      "isAdmin": {
        "columnName": "isAdmin",
        "type": "bool"
      },
      "email": {
        "columnName": "email",
        "type": "string",
        "length": 100
      },
      "departmentId": {
        "columnName": "DepartmentId",
        "type": "int"
      }
    },
    "primaryKey": {
      "name": "PK_Users",
      "columns": [
        "id"
      ]
    },
    "indexes": [
      {
        "name": "IX_Users_account",
        "unique": true,
        "columns": {
          "account": "ASC"
        }
      }
    ],
    "foreignKeys": [
      {
        "name": "FK_Department_Users",
        "columns": [
          "DepartmentId"
        ],
        "refer": "Department",
        "onDelete": "SET NULL"
      }
    ],
    "tableOptions": {}
  },
  "Relation": {
    "tableName": "Relations",
    "columns": {
      "userId": {
        "columnName": "userId",
        "type": "int",
        "primaryKey": true,
        "allowNull": false
      },
      "relativeId": {
        "columnName": "relativeId",
        "type": "int",
        "primaryKey": true,
        "allowNull": false
      }
    },
    "primaryKey": {
      "name": "PK_Relations",
      "columns": [
        "userId",
        "relativeId"
      ]
    },
    "indexes": [],
    "foreignKeys": [
      {
        "name": "FK_User_Relations_userId",
        "columns": [
          "userId"
        ],
        "refer": "User",
        "onDelete": "CASCADE"
      },
      {
        "name": "FK_User_Relations_relativeId",
        "columns": [
          "relativeId"
        ],
        "refer": "User",
        "onDelete": "CASCADE"
      }
    ],
    "tableOptions": {}
  },
  "RelationHistory": {
    "tableName": "RelationHistories",
    "columns": {
      "id": {
        "columnName": "id",
        "type": "bigint",
        "primaryKey": true,
        "autoIncrement": true
      },
      "userId": {
        "columnName": "userId",
        "type": "int",
        "allowNull": false
      },
      "relativeId": {
        "columnName": "relativeId",
        "type": "int",
        "allowNull": false
      },
      "description": {
        "columnName": "description",
        "type": "string"
      },
      "startedAt": {
        "columnName": "startedAt",
        "type": "timestamptz"
      }
    },
    "primaryKey": {
      "name": "PK_RelationHistories",
      "columns": [
        "id"
      ]
    },
    "indexes": [],
    "foreignKeys": [
      {
        "name": "FK_Relation_RelationHistories",
        "columns": [
          "userId",
          "relativeId"
        ],
        "refer": "Relation",
        "onDelete": "CASCADE"
      }
    ],
    "tableOptions": {}
  }
}
