Add SpacetimeDB conflict migration flow
This commit is contained in:
@@ -250,12 +250,24 @@ function normalizeSatsProduct(value) {
|
||||
};
|
||||
}
|
||||
|
||||
if (value.length === 5) {
|
||||
return {
|
||||
ok: normalizeSatsValue(value[0]),
|
||||
schema_version: normalizeSatsValue(value[1]),
|
||||
migration_json: normalizeSatsOption(value[2]),
|
||||
table_stats: normalizeTableStats(value[3]),
|
||||
warnings: [],
|
||||
error_message: normalizeSatsOption(value[4]),
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
ok: normalizeSatsValue(value[0]),
|
||||
schema_version: normalizeSatsValue(value[1]),
|
||||
migration_json: normalizeSatsOption(value[2]),
|
||||
table_stats: normalizeTableStats(value[3]),
|
||||
error_message: normalizeSatsOption(value[4]),
|
||||
warnings: normalizeMigrationWarnings(value[4]),
|
||||
error_message: normalizeSatsOption(value[5]),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -309,6 +321,28 @@ function normalizeTableStats(value) {
|
||||
});
|
||||
}
|
||||
|
||||
function normalizeMigrationWarnings(value) {
|
||||
if (!Array.isArray(value)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return value.map((entry) => {
|
||||
if (entry && typeof entry === 'object' && !Array.isArray(entry)) {
|
||||
return normalizeSatsValue(entry);
|
||||
}
|
||||
|
||||
if (Array.isArray(entry)) {
|
||||
return {
|
||||
table_name: normalizeSatsValue(entry[0]),
|
||||
warning_kind: normalizeSatsValue(entry[1]),
|
||||
message: normalizeSatsValue(entry[2]),
|
||||
};
|
||||
}
|
||||
|
||||
return entry;
|
||||
});
|
||||
}
|
||||
|
||||
export function resolveServerUrl(options) {
|
||||
if (options.serverUrl) {
|
||||
return options.serverUrl;
|
||||
|
||||
Reference in New Issue
Block a user