()
| 192 | } |
| 193 | |
| 194 | async verifySchemaVersion() { |
| 195 | const latest = await this.getLatestSchemaVersion(); |
| 196 | const expectedVersion = Number(pgConfig.migration.expectedVersion); |
| 197 | |
| 198 | if (!latest) { |
| 199 | return { |
| 200 | ok: false, |
| 201 | expectedVersion, |
| 202 | currentVersion: null, |
| 203 | reason: 'MISSING_MIGRATION_VERSION' |
| 204 | }; |
| 205 | } |
| 206 | |
| 207 | const currentVersion = Number(latest.version); |
| 208 | const isValid = currentVersion === expectedVersion; |
| 209 | |
| 210 | return { |
| 211 | ok: isValid, |
| 212 | expectedVersion, |
| 213 | currentVersion, |
| 214 | label: latest.label, |
| 215 | appliedAt: latest.applied_at, |
| 216 | reason: isValid ? 'OK' : 'SCHEMA_VERSION_MISMATCH' |
| 217 | }; |
| 218 | } |
| 219 | |
| 220 | async createTables() { |
| 221 | const tables = [ |
no test coverage detected