Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(db:create): support options on db:create #699

Closed
wants to merge 5 commits into from

Conversation

ALiangLiang
Copy link
Contributor

resolved #698
resolved #590
resolved #629

Use queryInterface.(create|drop)Database. So now we can:

  • Pass option to specify charset, collate... .
  • Use IF NOT EXISTS on database create and IF EXISTS on database drop. (postgresql not support IF NOT EXISTS on database)

But it's dependent on sequelize/sequelize@198cb52 . Not for release version now.

BTW. @sushantdhiman When is the release time of sequelize/master ? Is it for sequelize version 5?

@sushantdhiman
Copy link
Contributor

sequelize/master will be released as 5.0.0-beta.13 this weekend probably

@ALiangLiang
Copy link
Contributor Author

ALiangLiang commented Oct 16, 2018

O~k I see. So this PR cannot merge now right? It's required sequelize@5. 😕

Or I can make a version to use with sequelize@4. Just make a patch to support MySQL charset and collate.

const quoteIdentifier = sequelize.getQueryInterface().quoteIdentifier
await sequelize.query(`CREATE DATABASE ${quoteIdentifier(config.database)} CHARACTER SET ${quoteIdentifier(args.charset)} COLLATE ${quoteIdentifier(args.collate)`, {
  type: sequelize.QueryTypes.RAW
}).catch(e => helpers.view.error(e));

@sushantdhiman
Copy link
Contributor

We can switch to create/drop methods when sequelize@5 is used in cli, otherwise we can keep using old code for v4

@sushantdhiman
Copy link
Contributor

5.0.0-beta.13 was released with your changes for createDatabase / dropDatabase. Now we can use these commands when working with 5.0.0-beta.13 or above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants