Browse Source

feat(nocodb): expose DB_TYPES

pull/5222/head
Wing-Kam Wong 2 years ago
parent
commit
97750ee371
  1. 19
      packages/nocodb/src/lib/models/Base.ts
  2. 4
      packages/nocodb/src/lib/models/Project.ts

19
packages/nocodb/src/lib/models/Base.ts

@ -14,19 +14,22 @@ import { extractProps } from '../meta/helpers/extractProps';
import { NcError } from '../meta/helpers/catchError';
import SyncSource from './SyncSource';
export const DB_TYPES = <const>[
'mysql2',
'sqlite',
'mysql',
'mssql',
'snowflake',
'oracledb',
'pg',
];
// todo: hide credentials
export default class Base implements BaseType {
id?: string;
project_id?: string;
alias?: string;
type?:
| 'mysql2'
| 'sqlite'
| 'mysql'
| 'mssql'
| 'snowflake'
| 'oracledb'
| 'pg';
type?: typeof DB_TYPES[number];
is_meta?: BoolType;
config?: string;
created_at?: string;

4
packages/nocodb/src/lib/models/Project.ts

@ -1,4 +1,4 @@
import Base from './/Base';
import Base, { DB_TYPES } from './/Base';
import Noco from '../Noco';
import { BoolType, MetaType, ProjectType } from 'nocodb-sdk';
import {
@ -68,7 +68,7 @@ export default class Project implements ProjectType {
for (const base of project.bases) {
await Base.createBase(
{
type: base.config?.client,
type: base.config?.client as typeof DB_TYPES[number],
...base,
projectId,
},

Loading…
Cancel
Save