| 106 | }; |
| 107 | |
| 108 | const 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 | |
| 118 | const createPoolAndEnsureSchema = async () => |
| 119 | await createPool() |
no outgoing calls
no test coverage detected