lundi 22 février 2016

in sequelize nodejs orm why can't we use upsert with different field and model name

  var Customer = sequelize.define('Customer', {
    id: {
      field: "ïd",
      type: DataTypes.INTEGER,
      max: 11,
      allowNull: true,
      primaryKey: true,
      autoIncrement: true
    },
    outletCode: {
      field: "outlet_code",
      type: DataTypes.TEXT,
      max: 5,
      allowNull: true
    },
    outletName: {
      field: "outlet_name",
      type: DataTypes.TEXT,
      max: 100,
      allowNull: true
    },
    outletLocation: {
      field: "outlet_location",
      type: DataTypes.TEXT,
      max: 250,
      allowNull: true
    },
    code: {
      field: "code",
      type: DataTypes.TEXT,
      max: 10
    },
    name: {
      field: "name",
      type: DataTypes.TEXT,
      max: 200,
      allowNull: true
    },
    category: {
      field: "category",
      type: DataTypes.TEXT,
      max: 100
    },
    customerType: {
      field: "customer_type",
      type: DataTypes.TEXT,
      max: 45
    },
    type: {
      field: "type",
      type: DataTypes.TEXT,
      max: 50
    },
    business: {
      field: "business",
      type: DataTypes.TEXT,
      max: 50
    },
    emailId: {
      field: "email_id",
      type: DataTypes.TEXT,
      max: 120
    },
    mobile: {
      field: "mobile",
      type: DataTypes.TEXT,
      max: 20
    },
    phoneOne: {
      field: "phone1",
      type: DataTypes.TEXT,
      max: 20
    },
    phoneTwo: {
      field: "phone2",
      type: DataTypes.TEXT,
      max: 20
    },
    panNo: {
      field: "pan_no",
      type: DataTypes.TEXT,
      max: 20
    },
    cstNo: {
      field: "cst_no",
      type: DataTypes.TEXT,
      max: 20
    },
    tinNo: {
      field: "tin_no",
      type: DataTypes.TEXT,
      max: 20
    },
    tanNo: {
      field: "tan_no",
      type: DataTypes.TEXT,
      max: 20
    },
    eccNo: {
      field: "ecc_no",
      type: DataTypes.TEXT,
      max: 20
    },
    addressOne: {
      field: "address_one",
      type: DataTypes.TEXT,
      max: 100
    },
  }, {
    freezeTableName: true,
    tableName: "tbl_customer",
    underscored: true
  });
return Customer;
};

Aucun commentaire:

Enregistrer un commentaire