Browse Source

refactor: function name

pull/9259/head
Pranav C 3 months ago
parent
commit
244873ec53
  1. 4
      packages/nc-gui/components/smartsheet/Cell.vue
  2. 4
      packages/nc-gui/components/smartsheet/column/DefaultValue.vue
  3. 3
      packages/nocodb-sdk/src/lib/sqlUi/DatabricksUi.ts
  4. 3
      packages/nocodb-sdk/src/lib/sqlUi/MssqlUi.ts
  5. 18
      packages/nocodb-sdk/src/lib/sqlUi/MysqlUi.ts
  6. 4
      packages/nocodb-sdk/src/lib/sqlUi/OracleUi.ts
  7. 8
      packages/nocodb-sdk/src/lib/sqlUi/PgUi.ts
  8. 3
      packages/nocodb-sdk/src/lib/sqlUi/SnowflakeUi.ts
  9. 3
      packages/nocodb-sdk/src/lib/sqlUi/SqliteUi.ts

4
packages/nc-gui/components/smartsheet/Cell.vue

@ -128,12 +128,12 @@ const showCurrentDateOption = computed(() => {
return (
isEditColumnMenu.value &&
(isDate(column.value, abstractType.value) || isDateTime(column.value, abstractType.value)) &&
sqlUi.value?.getNowDefaultVal?.()
sqlUi.value?.getCurrentDateDefault?.(column.value)
)
})
const currentDate = () => {
vModel.value = sqlUi.value?.getNowDefaultVal?.()
vModel.value = sqlUi.value?.getCurrentDateDefault?.(column.value)
}
</script>

4
packages/nc-gui/components/smartsheet/column/DefaultValue.vue

@ -52,11 +52,11 @@ const sqlUi = computed(() =>
)
const showCurrentDateOption = computed(() => {
return [UITypes.Date, UITypes.DateTime].includes(vModel.value?.uidt) && sqlUi.value?.getNowDefaultVal?.()
return [UITypes.Date, UITypes.DateTime].includes(vModel.value?.uidt) && sqlUi.value?.getCurrentDateDefault?.(vModel.value)
})
const isCurrentDate = computed(() => {
return showCurrentDateOption.value && cdfValue.value?.toUpperCase?.() === sqlUi.value?.getNowDefaultVal?.()
return showCurrentDateOption.value && cdfValue.value?.toUpperCase?.() === sqlUi.value?.getCurrentDateDefault?.(vModel.value)
})
</script>

3
packages/nocodb-sdk/src/lib/sqlUi/DatabricksUi.ts

@ -1,5 +1,6 @@
import UITypes from '../UITypes';
import { IDType } from './index';
import { ColumnType } from '~/lib';
const dbTypes = [
'BIGINT',
@ -794,7 +795,7 @@ export class DatabricksUi {
];
}
static getNowDefaultVal() {
static getCurrentDateDefault(_col: Partial<ColumnType>) {
return null;
}

3
packages/nocodb-sdk/src/lib/sqlUi/MssqlUi.ts

@ -1,5 +1,6 @@
import UITypes from '../UITypes';
import { IDType } from './index';
import { ColumnType } from '~/lib';
const dbTypes = [
'bigint',
@ -969,7 +970,7 @@ export class MssqlUi {
];
}
static getNowDefaultVal() {
static getCurrentDateDefault(_col: Partial<ColumnType>) {
return null;
}

18
packages/nocodb-sdk/src/lib/sqlUi/MysqlUi.ts

@ -1,5 +1,5 @@
import UITypes from '../UITypes';
import { IDType } from '~/lib';
import { ColumnType, IDType } from '~/lib';
const dbTypes = [
'int',
@ -1335,7 +1335,21 @@ export class MysqlUi {
return ['COUNTA', 'COUNT', 'DATESTR'];
}
static getNowDefaultVal() {
static getCurrentDateDefault(col: Partial<ColumnType>) {
// if database datatype timestamp or datetime then return CURRENT_TIMESTAMP
if (
col.dt &&
(col.dt.toLowerCase() === 'timestamp' ||
col.dt.toLowerCase() === 'datetime')
) {
return 'CURRENT_TIMESTAMP';
}
// database type is not defined(means column create) and ui datatype is datetime then return CURRENT_TIMESTAMP
// in this scenario it will create column with datatype timestamp/datetime
if (!col.dt && col.uidt === UITypes.DateTime) {
return 'CURRENT_TIMESTAMP';
}
return null;
}

4
packages/nocodb-sdk/src/lib/sqlUi/OracleUi.ts

@ -1,4 +1,4 @@
import { NormalColumnRequestType } from '../Api';
import { ColumnType, NormalColumnRequestType } from '../Api';
import UITypes from '../UITypes';
import { IDType } from './index';
@ -952,7 +952,7 @@ export class OracleUi {
];
}
static getNowDefaultVal() {
static getCurrentDateDefault(_col: Partial<ColumnType>) {
return null;
}

8
packages/nocodb-sdk/src/lib/sqlUi/PgUi.ts

@ -1,5 +1,6 @@
import UITypes from '../UITypes';
import { IDType } from './index';
import { ColumnType } from '~/lib';
const dbTypes = [
'int',
@ -2032,8 +2033,11 @@ export class PgUi {
return [];
}
static getNowDefaultVal() {
return 'NOW()';
static getCurrentDateDefault(col: Partial<ColumnType>) {
if (col.uidt === UITypes.DateTime || col.uidt === UITypes.Date) {
return 'NOW()';
}
return null;
}
static isEqual(dataType1: string, dataType2: string) {

3
packages/nocodb-sdk/src/lib/sqlUi/SnowflakeUi.ts

@ -1,5 +1,6 @@
import UITypes from '../UITypes';
import { IDType } from './index';
import { ColumnType } from '~/lib';
const dbTypes = [
'NUMBER',
@ -1035,7 +1036,7 @@ export class SnowflakeUi {
];
}
static getNowDefaultVal() {
static getCurrentDateDefault(_col: Partial<ColumnType>) {
return null;
}

3
packages/nocodb-sdk/src/lib/sqlUi/SqliteUi.ts

@ -1,5 +1,6 @@
import UITypes from '../UITypes';
import { IDType } from './index';
import { ColumnType } from '~/lib';
const dbTypes = [
'int',
@ -930,7 +931,7 @@ export class SqliteUi {
];
}
static getNowDefaultVal() {
static getCurrentDateDefault(_col: Partial<ColumnType>) {
return null;
}

Loading…
Cancel
Save