
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
Get your database metadata info
readdb is a package to get database metadata such as tables, fields, foreign and primary keys.
On your console, run
npm install readdb --save
First, you may require the readdb package
const readdb = require( 'readdb');
Then, instantiate a new readdb object and connect to your database usign the credentials like this
new readdb( 'database', 'user', 'password' )
To finally use the readdb class, you need to call the method setup. This method returns a promise with the configured readdb object
readdb.setup().then( readdb => {
// now you con navigate through your database
readdb.onTables( table => {
// look, a table that i found
console.log( table.name );
});
})
.catch( err => {
// something went wrong ......
console.log( err );
});
Check the full exemple code
const readdb = require( 'readdb');
new readdb( 'database', 'user', 'password' ).setup().then( readdb => {
// now you con navigate through your database
readdb.onTables( table => {
// look, a table that i found
console.log( table.name );
});
})
.catch( err => {
// something went wrong ......
console.log( err );
});
setup() set the database mapping
onTables( callback ) executes a function for each table found on database
table() gets a specific table of the database
name: string name of the table
onFields( callaback ) execute a function for each field of the table
onForeignKeys( callback ) execute a function for each foreign key of the table
onPrimaryKeys( callback ) execute a function for each primary key of the table
name: string name of the field
type: string the type of the field
size: number the size of the field
allowNull: boolean if the field allows null values
defaultValue: string the default value for this field
primaryKey: boolean if a field is a primary key or not
When you instantiate a new readdb class, it accepts four params. They are:
database: string the database name
user: string the database user
password: string the password
option: object and object with some configuration.
The fourth param, options, acceppts this properties
var db = new readdb('database', 'user', 'pass', {
host: 'localhost',
dialect: 'mysql'|'mariadb'|'sqlite'|'postgres'|'mssql',
directory: false, // prevents the program from writing to disk
port: 'port',
additional: {
timestamps: false
//...
},
tables: ['table1', 'table2', 'table3']
//...
})
Readdb works with mysql as default, but it can run with mariadb, sqlite, postgres and mssql as well. To do this, you need install it's respective npm package.
FAQs
A tool for read Databases metadata
We found that readdb demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.