-1

I have created migration in camel casing but when i run migration it will automatically convert it into a snake casing. how i can make it camel case by default.

 public async up() {
    this.schema.createTable(this.tableName, (table) => {
      table.increments('id')
      table.string('firstName', 50).notNullable()
      table.string('lastName', 50).notNullable()
      table.string('email', 255).notNullable().unique()
      table.string('password', 180).notNullable()
      table.string('rememberMeToken').nullable()
      table.timestamp('createdAt', { useTz: true })
      table.timestamp('updatedAt', { useTz: true })
    })
  }

but in database it is showing like this enter image description here

Mradul Jain
  • 62
  • 12

1 Answers1

0

you probably want to add this to your DB configuration


const { knexSnakeCaseMappers } = require("objection");

pg: ({
    ...{
      client: 'pg',
      connection: {
        host: Env.get('HOST', '127.0.0.1'),
        port: Env.get('DB_PORT', ''),
        user: Env.get('DB_USER', 'user'),
        password: Env.get('DB_PASSWORD', ''),
        database: Env.get('DB_DATABASE', 'your_db_name')
      },
      debug: Env.get('DB_DEBUG', false)
    },
    ...knexSnakeCaseMappers() // This here should do the trick
  })

regards.

Juan Ricardo
  • 143
  • 8