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

176
Views
Why does Sequelize pluralize 'media' to medium

I'm having a really big issue with sequelize trying to give me its best guess at what it thinks my table name is.

I have 3 tables. Properties, Media and a junction table PropertyMedia

For some reason when I do a join query with sequelize it gives me the error

error: column Properties->PropertyMedia.medium_id does not exist

I have done a global search to make sure that I don't have the word medium anywhere and I don't

let Media = sequelize.define('Media', {
    url: DataTypes.STRING,
    isVideo: DataTypes.BOOLEAN
}, { freezeTableName: true, tableName: 'media' });

let PropertyMedia = sequelize.define('PropertyMedia', {
    propertyId: DataTypes.INTEGER,
    mediaId: DataTypes.INTEGER
}, { freezeTableName: true, tableName: 'property_media' });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It doesn't pluralize to "medium", it singularizes to "medium".

That is because "media" is the plural of "medium" and by default table names use the plural and references use the singular, just like you'd have user_id (singular) reference users (plural), so here medium_id (not media_id) is expected to reference media.

It's true that nowadays in English another (usually) uncountable noun "media" emerged from that (probably1 from people forgetting that it does originate from the Latin word medium in plural), but that's a special case Sequelize doesn't know about, really, and also it couldn't discern which of the two nouns you meant.

For this reason, Sequelize has ways to override the singular/plural forms.


1: I'm not an etymologist so please take this with a grain of salt.

about 4 years ago · Juan Pablo Isaza 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!