首页 > 解决方案 > 如何设置模态数据库 postgresSQL

问题描述

我正在为我的数据库使用 postgres,并且我正在尝试为每个团队创建一个规则

这是我的数据库中的以下代码:

module.exports = (sequelize, DataTypes) => {
  const Team = sequelize.define(
    "Team",
    {
      id: {
        type: DataTypes.UUID,
        defaultValue: DataTypes.UUIDV4,
        primaryKey: true,
        allowNull: false,
      },
      title: {
        type: DataTypes.STRING,
        allowNull: false,
      },
      type: DataTypes.STRING,
      mission: DataTypes.STRING,
      agreement: DataTypes.STRING,
    },
    {
      tableName: "Teams",
      timestamps: true,
      indexes: [{ unique: false, fields: ["id", "title"] }],
    }
  );

在此处输入图像描述

所以协议数据类型是我的规则。我是否需要将其更改为数组并在模式中创建 4 条规则,或者无论如何我可以用字符串来做到这一点?

标签: node.jspostgresql

解决方案


推荐阅读