MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / ensureSchema

Function ensureSchema

cloud-sql/mysql/mysql2/index.js:118–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116};
117
118const ensureSchema = async pool => {
119 // Wait for tables to be created (if they don't already exist).
120 await pool.query(
121 `CREATE TABLE IF NOT EXISTS votes
122 ( vote_id SERIAL NOT NULL, time_cast timestamp NOT NULL,
123 candidate CHAR(6) NOT NULL, PRIMARY KEY (vote_id) );`
124 );
125 console.log("Ensured that table 'votes' exists");
126};
127
128const createPoolAndEnsureSchema = async () =>
129 await createPool()

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected