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

Function ensureSchema

cloud-sql/mysql/mysql/index.js:108–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106};
107
108const ensureSchema = async pool => {
109 // Wait for tables to be created (if they don't already exist).
110 await pool.query(
111 `CREATE TABLE IF NOT EXISTS votes
112 ( vote_id SERIAL NOT NULL, time_cast timestamp NOT NULL,
113 candidate CHAR(6) NOT NULL, PRIMARY KEY (vote_id) );`
114 );
115 console.log("Ensured that table 'votes' exists");
116};
117
118const createPoolAndEnsureSchema = async () =>
119 await createPool()

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected