sequelize / sequelize/sequelize

Support `collate` for MSSQL dialect

Open
#9,929 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

dialect: mssql type: feature
Dominant language
TypeScript
Stars
30.4k
Forks
4.3k
Avg merge
1d 6h
Merged PRs (30d)
68

Description

What are you doing?

const db = new Sequelize('database', 'username', 'password', {
	host: 'host',
	define: {
		charset: 'utf8',
		collate: 'utf8_general_cs'
	},
	dialect: 'mssql'
});

What do you expect to happen?

I wanted the CREATE TABLE SQL to generate tables with the specified collation.

What is actually happening?

Sequelize apparently does not support setting collation for individual fields in MSSQL dialect.

Dialect: mssql
Dialect version: tedious@2.6.4
Database version: MSSQL Server 2014
Sequelize version: 4.38.1
Tested with latest release: Yes, v4.38.1

Why are you doing this?

Because my client wants to use MSSQL, and I cannot change the database-level collation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Sequelize configuration against MSSQL Server and inspect how the MSSQL dialect generates CREATE TABLE SQL. Trace where the define.collate setting is handled for fields, then add coverage for the requested collation behavior; done means generated tables use the specified collation without requiring a database-level change.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql, typescript
Domain
database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.