Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

130
Views
Sequelize/Postgres: la escala NUMÉRICA 7 debe estar entre 0 y precisión 2

Problema Parece que no puedo averiguar cómo resolver el error al migrar decimal a Heroku.

En mi secuela, funciona bien, pero heroku me da este error para postgres:

migración

 async up(queryInterface, Sequelize) { await queryInterface.createTable('Spots', { id: { allowNull: false, autoIncrement: true, primaryKey: true, type: Sequelize.INTEGER }, address: { type: Sequelize.STRING(255), allowNull: false }, city: { type: Sequelize.STRING(50), allowNull: false }, state: { type: Sequelize.STRING(50), allowNull: false }, country: { type: Sequelize.STRING(50), allowNull: false }, lat: { type: Sequelize.DECIMAL(10, 7) }, lng: { type: Sequelize.DECIMAL(10, 7) }, name: { type: Sequelize.STRING(50) }, description: { type: Sequelize.STRING(255) }, price: { type: Sequelize.DECIMAL(4, 2) }, avgStarRating: { type: Sequelize.DECIMAL(2, 1) }, ownerId: { type: Sequelize.INTEGER }, createdAt: { allowNull: false, type: Sequelize.DATE, defaultValue: Sequelize.literal("CURRENT_TIMESTAMP") }, updatedAt: { allowNull: false, type: Sequelize.DATE, defaultValue: Sequelize.literal("CURRENT_TIMESTAMP") } }); },

Error

 ERROR: NUMERIC scale 7 must be between 0 and precision 2

Salida de muestra:

 { "Spots": [ { ..., "lat": 37.7645358, "lng": -122.4730327, ... } ] }

Intenté cambiar todos los DECIMAL a NUMERIC/FLOAT (solo para probar si funciona) y aún así resultó en el mismo error. ¿Qué puedo estar haciendo mal? ¡Gracias!

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Para un tipo numérico, el primer número es el número total de dígitos a representar, incluidos ambos lados del punto decimal. El segundo valor es el número de dígitos a la derecha del punto decimal. Por lo tanto, (2, 7) no tiene sentido.

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!