| 141 | }; |
| 142 | |
| 143 | const ensureSchema = async pool => { |
| 144 | const hasTable = await pool.schema.hasTable('votes'); |
| 145 | if (!hasTable) { |
| 146 | return pool.schema.createTable('votes', table => { |
| 147 | table.increments('vote_id').primary(); |
| 148 | table.timestamp('time_cast', 30).notNullable(); |
| 149 | table.specificType('candidate', 'CHAR(6)').notNullable(); |
| 150 | }); |
| 151 | } |
| 152 | logger.info("Ensured that table 'votes' exists"); |
| 153 | }; |
| 154 | |
| 155 | const createPoolAndEnsureSchema = async () => |
| 156 | await createPool() |
no outgoing calls
no test coverage detected