A set of database common operations functions for MySQL. In particular, you can operate the database on the specific server, the operations include create, delete, drop, use, backup, restore, clone.
npm i mypower --save
Initialize MyPower first:
// Your mysql configuration
const config = {
database: 'sys',
username: 'root',
password: 'playboy',
host: '127.0.0.1',
port: 3306,
};
const my = require('mypower');
my.init(config);
Click below links to see usages (from test cases).
The * indicates that databases on other servers can be operated remotely.
- my.connectServer() *
- my.isServerOnline() *
- my.switchToServer() *
- my.backupAllDatabases() *
- my.backupDatabase() *
- my.cloneDatabase() *
- my.cloneDatabaseStructure() *
- my.renameDatabase()
- my.restoreAllDatabases() *
- my.restoreDatabase() *
- my.createDatabase() *
- my.deleteDatabase() *
- my.dropDatabase() *
- my.getDatabasesName() *
- my.getSelectedDatabase() *
- my.isDatabaseExists() *
- my.showDatabases() *
- my.useDatabase() *
- my.addField()
- my.addFields()
- my.changeField()
- my.changeFieldName()
- my.changeFieldType()
- my.changeFields()
- my.convertFieldTypeDefToStr()
- my.deleteField()
- my.deleteFields()
- my.fieldTypes
- my.getAutoIdName()
- my.getFieldNames()
- my.getFieldNamesWithoutAutoId()
- my.getFieldType()
- my.getFieldTypeStr()
- my.getFieldsInfo()
- my.isFieldExists()
- my.updateField()
- my.updateFields()
- my.addPrimaryKey()
- my.addPrimaryKeys()
- my.getPrimaryKey()
- my.getPrimaryKeys()
- my.getMaxFieldValue()
- my.getMaxId()
- my.getMaxPrimaryKeyValue()
- my.getMaxRecord()
- my.getMinFieldValue()
- my.getMinId()
- my.getMinRecord()
- my.isRecordExists()
- my.recordsCount()
- my.getSystemVariable()
- my.getSystemVariables()
- my.getVersion()
- my.getWarningCount()
- my.isSuccessful()
- my.cloneTable()
- my.cloneTableStructure()
- my.copyTableData()
- my.createTable()
- my.deleteTable()
- my.deleteTables()
- my.descTable()
- my.dropTable()
- my.dropTables()
- my.isEmptyTable()
- my.isTableExists()
- my.moveTable()
- my.renameTable()
- my.showTables()
- my.truncateTable()
- my.exec()
- my.execSp()
- my.count()
- my.next()
- my.previous()
git clone https://github.com/hiowenluke/mypower
cd mypower
npm install
npm test
Copyright (c) 2019, Owen Luke