Skip to content
This repository was archived by the owner on Jun 2, 2024. It is now read-only.

Migrating from 1.x to 2.x

fengmk2 edited this page Nov 1, 2014 · 9 revisions

2.x using Sequelize ORM to supports MySQL, MariaDB, SQLite or PostgreSQL databases.

config.js changes in 2.x

New database config

  /**
   * database config
   */

  database: {
    db: 'cnpmjs_test',
    username: 'root',
    password: '',

    // the sql dialect of the database
    // - currently supported: 'mysql', 'sqlite', 'postgres', 'mariadb'
    dialect: 'sqlite',

    // custom host; default: 127.0.0.1
    host: '127.0.0.1',

    // custom port; default: 3306
    port: 3306,

    // use pooling in order to reduce db connection overload and to increase speed
    // currently only for mysql and postgresql (since v1.5.0)
    pool: {
      maxConnections: 10,
      minConnections: 0,
      maxIdleTime: 30000
    },

    // the storage engine for 'sqlite'
    // default store into ~/cnpmjs.org.sqlite
    storage: path.join(process.env.HOME || root, 'cnpmjs.org.sqlite'),

    logging: !!process.env.SQL_DEBUG,
  },

If you're still using MySQL and old config.js mysqlServers: [] from 1.x:

  mysqlServers: [
    {
      host: '127.0.0.1',
      port: 3306,
      user: 'root',
      password: ''
    }
  ],
  mysqlDatabase: 'cnpmjs_test',
  mysqlMaxConnections: 4,
  mysqlQueryTimeout: 5000,

We will do forward compat, and auto change old style config.js to:

  database: {
    db: 'cnpmjs_test',
    username: 'root',
    password: '',
    dialect: 'mysql',
    host: '127.0.0.1',
    port: 3306,
    pool: {
      maxConnections: 10,
      minConnections: 0,
      maxIdleTime: 30000
    },
    logging: !!process.env.SQL_DEBUG,
  },

remove adaptScope

adaptScope: true | false feature was removed.

Clone this wiki locally