PR comments
This commit is contained in:
parent
bca9bd27db
commit
b6fcdf301d
|
@ -29,7 +29,7 @@ async function updated(oldTable: Table, newTable: Table) {
|
||||||
for (const key in newTable.schema) {
|
for (const key in newTable.schema) {
|
||||||
if (!oldTable.schema[key]) {
|
if (!oldTable.schema[key]) {
|
||||||
const newColumn = newTable.schema[key]
|
const newColumn = newTable.schema[key]
|
||||||
if ("default" in newColumn) {
|
if ("default" in newColumn && newColumn.default != null) {
|
||||||
defaultValues = true
|
defaultValues = true
|
||||||
}
|
}
|
||||||
if (newColumn.type === FieldType.AI) {
|
if (newColumn.type === FieldType.AI) {
|
||||||
|
|
|
@ -187,21 +187,15 @@ async function handleViewEvents(existingView: ViewV2, view: ViewV2) {
|
||||||
|
|
||||||
// if new columns in the view
|
// if new columns in the view
|
||||||
for (const key in view.schema) {
|
for (const key in view.schema) {
|
||||||
if (!existingView?.schema?.[key]) {
|
if ("calculationType" in view.schema[key] && !existingView?.schema?.[key]) {
|
||||||
// view calculations
|
|
||||||
// @ts-expect-error non calculation types just won't have the calculationType field
|
|
||||||
const calculationType = view.schema[key].calculationType
|
|
||||||
if (calculationType) {
|
|
||||||
await events.view.calculationCreated({
|
await events.view.calculationCreated({
|
||||||
calculationType,
|
calculationType: view.schema[key].calculationType,
|
||||||
tableId: view.tableId,
|
tableId: view.tableId,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// view joins
|
// view joins
|
||||||
if (view.schema[key].columns) {
|
for (const column in view.schema[key]?.columns ?? []) {
|
||||||
for (const column in view.schema[key]?.columns) {
|
|
||||||
// if the new column is visible and it wasn't before
|
// if the new column is visible and it wasn't before
|
||||||
if (
|
if (
|
||||||
!existingView?.schema?.[key].columns?.[column].visible &&
|
!existingView?.schema?.[key].columns?.[column].visible &&
|
||||||
|
@ -213,7 +207,6 @@ async function handleViewEvents(existingView: ViewV2, view: ViewV2) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
export async function update(ctx: Ctx<UpdateViewRequest, UpdateViewResponse>) {
|
export async function update(ctx: Ctx<UpdateViewRequest, UpdateViewResponse>) {
|
||||||
const view = ctx.request.body
|
const view = ctx.request.body
|
||||||
|
|
Loading…
Reference in New Issue