create table - changed workflow

This commit is contained in:
Jan Prochazka
2024-09-19 09:00:13 +02:00
parent d1e98e5640
commit f7c5ffa0ce
7 changed files with 85 additions and 85 deletions

View File

@@ -0,0 +1,48 @@
import _ from 'lodash';
import openNewTab from '../utility/openNewTab';
import { findEngineDriver, getConnectionLabel } from 'dbgate-tools';
import { getExtensions } from '../stores';
export default function newTable(connection, database) {
const tooltip = `${getConnectionLabel(connection)}\n${database}`;
const driver = findEngineDriver(connection, getExtensions());
openNewTab(
{
title: 'Table #',
tooltip,
icon: 'img table-structure',
tabComponent: 'TableStructureTab',
props: {
conid: connection._id,
database,
},
},
{
editor: {
current: {
pureName: 'new_table',
schemaName: driver?.dialect?.defaultSchemaName,
columns: [
{
columnName: 'id',
dataType: 'int',
isNullable: false,
isPrimaryKey: true,
isAutoIncrement: true,
},
],
primaryKey: {
columns: [
{
columnName: 'id',
},
],
},
},
},
},
{
forceNewTab: true,
}
);
}