| 116 | }; |
| 117 | |
| 118 | const 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 | |
| 128 | const createPoolAndEnsureSchema = async () => |
| 129 | await createPool() |
no outgoing calls
no test coverage detected