Skip to content

Commit 478a996

Browse files
committed
feat: add extra mingration validations
1 parent 79536b1 commit 478a996

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/util/migrate.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ const typeMap = {
1717
'System Board': 'Board',
1818
};
1919

20-
async function validate(schema, items = [], tableName, sql) {
20+
async function validate(schema, items = [], tableName) {
2121
try {
22-
return yup
22+
return await yup
2323
.array()
2424
.of(schema)
2525
.validate(items, { stripUnknown: true, abortEarly: false });
2626
} catch (err) {
27-
err.sql = sql;
2827
err.validation = true;
2928
err.tableName = tableName;
3029
throw err;
@@ -61,7 +60,7 @@ function fetchTable(base, tableName) {
6160
}
6261

6362
async function validateForDb(tableName, items) {
64-
return validate(dbSchemas[tableName], items, tableName, true);
63+
return validate(dbSchemas[tableName], items, tableName);
6564
}
6665

6766
async function saveToDb(tableName, items) {
@@ -250,7 +249,7 @@ async function migrate(apiKey, baseId) {
250249

251250
throwNecessaryValidationErrors(
252251
validatedSqlTables,
253-
'There were SQL schema errors during the migration! Please fix contact a developer about them.',
252+
'There were SQL schema errors during the migration! Please contact a developer about them.',
254253
);
255254

256255
const [

0 commit comments

Comments
 (0)