0

How should i define the infinity in my database. i use

  • nodejs
  • fastify
  • sequelize
  • sqlite3

There are a few data should deal with:

  • deadline: unlimited time or a date, type:string format:date
  • usetimes: infinity type:number

Do i need to change the type and validation to fix with the "infinity" words.such as:

//model

usetimes: {
    type     : DataTypes.Integer, ======> DataTypes.['string','Interger']
    allowNull: false,
   // validate : {
   //   min: -1
   // }
  },

when i change the type,how can i do the validation? Please tell me how to deal with the infinity.

radiorz
  • 1,459
  • 4
  • 18
  • 36
  • Infinity is not a value you can store. You need to define a domain set of values, like -1 means infinity in your application logic – Manuel Spigolon Nov 30 '20 at 19:14
  • @ManuelSpigolon for the date-type data like '2020-12-01' ,should i also define -1? but how can i validate this value. – radiorz Dec 01 '20 at 02:25

0 Answers0