Config `option` are not being picked up and used.
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, postgres
Research direction
Start by reproducing the configuration shown in .sequelizerc and myconfig.js, using the model:generate command with the PostgreSQL dialect. Trace the CLI's config loading and option handling, then verify that define options affect generated migration columns: paranoid adds deleted_at and underscored maps createdAt and updatedAt to snake case.
Written by the indexing model from the issue text.
Description
What you are doing?
Sequelize has a parameter in it's constructor called options https://sequelize.org/api/v6/class/src/sequelize.js~sequelize#instance-constructor-constructor
which has an item called define (more on the define) where additional items such as underscored, paranoid, timestamps etc. can be specified.
In my custom config file specified in the .sequelizerc, I have the that options object, however, they are not being picked up.
It seems like only the underscored work if and only if included in the model:generate as an option --underscored
// .sequelizerc
module.exports = {
'config': path.resolve('src', 'myconfig.js'),
'models-path': path.resolve('src', 'models')
};
// myconfig.js
const username = process.env.DATABASE_USERNAME;
const password = process.env.DATABASE_PASSWORD;
const database = process.env.DATABASE_NAME;
const host = process.env.DATABASE_HOST;
const dialect = 'postgres';
const options = {
define: {
underscored: true,
paranoid: true,
},
};
module.exports = { username, password, database, host, dialect, options };
// Also tried this:
const define = {
underscored: true,
paranoid: true
};
module.exports = { username, password, database, host, dialect, define };
What do you expect to happen?
I expect the config attributes to be picked up and work such that the migration file would include a deleted_at and the createdAt and updatedAt would be created_at and updated_at respectively.
What is actually happening?
It's not picking them up and using the default behaviour. It works exactly the same way with and without the options.
The deleted_at is not created. The createdAt and updatedAt remain the same.
Dialect: postgres
Sequelize CLI version: 6.4.1
Sequelize version: 6.21.3
Edit 1:
include the module.exports in the myconfig.js as per the comment: https://github.com/sequelize/cli/issues/1139#issuecomment-1219506878
- Dominant language
- JavaScript
- Stars
- 2.6k
- Forks
- 524
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sequelize/cli
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Similar issues
-
bot:ai-assisted component:compact-js status:untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
midnightntwrk/midnight-sdk#403 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
DavidAnson/markdownlint-cli2#940 ·
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
githubnext/gh-aw-workshop#3692 ·
-
agent/guide documentation hive/hosted-available-lke648397-260827-5n31
Difficulty 2/5 1-3 hours Newbie friendliness 90/100