2

How to create database using knex npm?

Here it is MYSQL query

create database 'test'

I want to convert this query using knex.

1
  • 3
    knex.raw('create database test').then((resp) => { }) using this query create database Commented Nov 14, 2017 at 7:56

1 Answer 1

2

There is no special API for creating DB in knex, probably because knex usually connects to already created DB and to be honest database creation is pretty rare operation.

Npm package knex-db-manager (https://vincit.github.io/knex-db-manager/) can do also database maintenance tasks and has separate superuser and normal user connection.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.