sequelize / sequelize/sequelize
Mysql dialect support for createFunction and dropFunction
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 30.4k
- Forks
- 4.3k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 68
Description
What are you doing?
// Using a Mysql server...
(sequelize) => {
const queryInterface = sequelize.getQueryInterface();
queryInterface.dropFunction('TEST_FUNC').finally(() => {
queryInterface.createFunction(
'TEST_FUNC',
[{name: 'test_param', type: 'VARCHAR(100)', direction: 'IN'}],
'VARCHAR(100)',
'SQL',
'RETURN test_param;',
['DETERMINISTIC']
).then(
() => console.log('TEST_FUNC created'),
(error) => { throw error }
);
});
}
What do you expect to happen?
Mysql database acquires the function TEST_FUNC.
What is actually happening?
TypeError: this.QueryGenerator.createFunction is not a function
…and, indeed, there is no createFunction in sequelize/lib/dialects/mysql/query-generator.js.
I needed this for my project, please find my patch for 5.0.0-beta.10 attached.
Dialect: mysql
Dialect version: (5.0.0-beta.10)
Database version: any
Sequelize version: 5.0.0-beta.10
Tested with latest release: Yes
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.
Research direction
Start in sequelize/lib/dialects/mysql/query-generator.js and compare the existing dialect implementations of createFunction and dropFunction. Verify the reported sample against MySQL; done means the MySQL query interface supports both operations without the reported TypeError and creates and drops TEST_FUNC.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mysql
- Domain
- database
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100