MySQL is an open-source relational database management system.
Emit new event when you add or modify a new row in a table. See the docs here
Emit new event when new rows are returned from a custom query. See the docs here
Emit new event when a new table is added to a database. See the docs here
MySQL is a powerful database management system used by some of the largest
organizations in the world, including Facebook, Google, and Amazon. MySQL is an
open-source relational database management system (RDBMS), as well as a popular
choice for web applications used by millions of websites.
Some applications that can be built using the MySQL API include:
import mysql from 'mysql2/promise';
export default defineComponent({
props: {
mysql: {
type: "app",
app: "mysql",
}
},
async run({steps, $}) {
const {
host,
port,
username: user,
password,
database,
ca,
key,
cert,
reject_unauthorized: rejectUnauthorized,
} = this.mysql.$auth;
const isRejectUnauthorizedUndefined = rejectUnauthorized === undefined;
const isSslSet = !!(ca && key && cert);
const connectionConfig = {
host,
port,
user,
password,
database,
...(isSslSet && {
ssl: {
rejectUnauthorized: true,
ca,
cert,
key,
},
}),
...(!isSslSet && !isRejectUnauthorizedUndefined && {
ssl: {
rejectUnauthorized,
},
}),
};
const connection = await mysql.createConnection(connectionConfig);
const [rows] = await connection.execute('SELECT NOW()');
return rows;
},
});
// To use previous step data, pass the `steps` object to the run() function
export default defineComponent({
async run({ steps, $ }) {
// Return data to use it in future steps
return steps.trigger.event
},
})