mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-02 00:54:00 +00:00
Merge branch 'beforeUpdates'
This commit is contained in:
2
.github/FUNDING.yml
vendored
Normal file
2
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
github: dbgate
|
||||||
|
open_collective: dbgate
|
||||||
3
.github/workflows/build-app-beta.yaml
vendored
3
.github/workflows/build-app-beta.yaml
vendored
@@ -35,6 +35,9 @@ jobs:
|
|||||||
- name: fillNativeModulesElectron
|
- name: fillNativeModulesElectron
|
||||||
run: |
|
run: |
|
||||||
yarn fillNativeModulesElectron
|
yarn fillNativeModulesElectron
|
||||||
|
- name: fillPackagedPlugins
|
||||||
|
run: |
|
||||||
|
yarn fillPackagedPlugins
|
||||||
- name: Install Snapcraft
|
- name: Install Snapcraft
|
||||||
if: matrix.os == 'ubuntu-18.04'
|
if: matrix.os == 'ubuntu-18.04'
|
||||||
uses: samuelmeuli/action-snapcraft@v1
|
uses: samuelmeuli/action-snapcraft@v1
|
||||||
|
|||||||
3
.github/workflows/build-app.yaml
vendored
3
.github/workflows/build-app.yaml
vendored
@@ -39,6 +39,9 @@ jobs:
|
|||||||
- name: fillNativeModulesElectron
|
- name: fillNativeModulesElectron
|
||||||
run: |
|
run: |
|
||||||
yarn fillNativeModulesElectron
|
yarn fillNativeModulesElectron
|
||||||
|
- name: fillPackagedPlugins
|
||||||
|
run: |
|
||||||
|
yarn fillPackagedPlugins
|
||||||
- name: Install Snapcraft
|
- name: Install Snapcraft
|
||||||
if: matrix.os == 'ubuntu-18.04'
|
if: matrix.os == 'ubuntu-18.04'
|
||||||
uses: samuelmeuli/action-snapcraft@v1
|
uses: samuelmeuli/action-snapcraft@v1
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -30,4 +30,5 @@ yarn-debug.log*
|
|||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
app/src/nativeModulesContent.js
|
app/src/nativeModulesContent.js
|
||||||
packages/api/src/nativeModulesContent.js
|
packages/api/src/nativeModulesContent.js
|
||||||
|
packages/api/src/packagedPluginsContent.js
|
||||||
.VSCodeCounter
|
.VSCodeCounter
|
||||||
@@ -1,5 +1,11 @@
|
|||||||
# ChangeLog
|
# ChangeLog
|
||||||
|
|
||||||
|
### 4.2.2
|
||||||
|
- CHANGED: Further startup optimalization (approx. 2 times quicker start of electron app)
|
||||||
|
|
||||||
|
### 4.2.1
|
||||||
|
- FIXED: Fixed+optimalized app startup (esp. on Windows)
|
||||||
|
|
||||||
### 4.2.0
|
### 4.2.0
|
||||||
- ADDED: Support of SQLite database
|
- ADDED: Support of SQLite database
|
||||||
- ADDED: Support of Amazon Redshift database
|
- ADDED: Support of Amazon Redshift database
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
"icon": "icon.png",
|
"icon": "icon.png",
|
||||||
"artifactName": "dbgate-linux-${version}.${ext}",
|
"artifactName": "dbgate-linux-${version}.${ext}",
|
||||||
"category": "Development",
|
"category": "Development",
|
||||||
"synopsis": "Database administration tool for MS SQL, MySQL and PostgreSQL",
|
"synopsis": "Database manager for SQL Server, MySQL, PostgreSQL, MongoDB and SQLite",
|
||||||
"publish": [
|
"publish": [
|
||||||
"github"
|
"github"
|
||||||
]
|
]
|
||||||
|
|||||||
23
fillPackagedPlugins.js
Normal file
23
fillPackagedPlugins.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
function load() {
|
||||||
|
const plugins = {};
|
||||||
|
|
||||||
|
for (const packageName of fs.readdirSync('plugins')) {
|
||||||
|
if (!packageName.startsWith('dbgate-plugin-')) continue;
|
||||||
|
const dir = path.join('plugins', packageName);
|
||||||
|
const frontend = fs.readFileSync(path.join(dir, 'dist', 'frontend.js'), 'utf-8');
|
||||||
|
const readme = fs.readFileSync(path.join(dir, 'README.md'), 'utf-8');
|
||||||
|
const manifest = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf-8'));
|
||||||
|
plugins[packageName] = {
|
||||||
|
manifest,
|
||||||
|
frontend,
|
||||||
|
readme,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return plugins;
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.writeFileSync('packages/api/src/packagedPluginsContent.js', `module.exports = () => (${JSON.stringify(load())});`);
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "4.2.1-beta.1",
|
"version": "4.2.2",
|
||||||
"name": "dbgate-all",
|
"name": "dbgate-all",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"packages/*",
|
"packages/*",
|
||||||
@@ -32,6 +32,8 @@
|
|||||||
"generatePadFile": "node generatePadFile",
|
"generatePadFile": "node generatePadFile",
|
||||||
"fillNativeModules": "node fillNativeModules",
|
"fillNativeModules": "node fillNativeModules",
|
||||||
"fillNativeModulesElectron": "node fillNativeModules --electron",
|
"fillNativeModulesElectron": "node fillNativeModules --electron",
|
||||||
|
"fillPackagedPlugins": "node fillPackagedPlugins",
|
||||||
|
"resetPackagedPlugins": "node resetPackagedPlugins",
|
||||||
"prettier": "prettier --write packages/api/src && prettier --write packages/datalib/src && prettier --write packages/filterparser/src && prettier --write packages/sqltree/src && prettier --write packages/tools/src && prettier --write packages/types && prettier --write packages/web/src && prettier --write app/src",
|
"prettier": "prettier --write packages/api/src && prettier --write packages/datalib/src && prettier --write packages/filterparser/src && prettier --write packages/sqltree/src && prettier --write packages/tools/src && prettier --write packages/types && prettier --write packages/web/src && prettier --write app/src",
|
||||||
"copy:docker:build": "copyfiles packages/api/dist/* docker -f && copyfiles packages/web/public/* docker -u 2 && copyfiles \"packages/web/public/**/*\" docker -u 2 && copyfiles \"plugins/dist/**/*\" docker/plugins -u 2",
|
"copy:docker:build": "copyfiles packages/api/dist/* docker -f && copyfiles packages/web/public/* docker -u 2 && copyfiles \"packages/web/public/**/*\" docker -u 2 && copyfiles \"plugins/dist/**/*\" docker/plugins -u 2",
|
||||||
"prepare:docker": "yarn plugins:copydist && yarn build:web:docker && yarn build:api && yarn copy:docker:build",
|
"prepare:docker": "yarn plugins:copydist && yarn build:web:docker && yarn build:api && yarn copy:docker:build",
|
||||||
@@ -40,7 +42,7 @@
|
|||||||
"ts:api": "yarn workspace dbgate-api ts",
|
"ts:api": "yarn workspace dbgate-api ts",
|
||||||
"ts:web": "yarn workspace dbgate-web ts",
|
"ts:web": "yarn workspace dbgate-web ts",
|
||||||
"ts": "yarn ts:api && yarn ts:web",
|
"ts": "yarn ts:api && yarn ts:web",
|
||||||
"postinstall": "yarn build:lib && patch-package && yarn fillNativeModules && yarn build:plugins:frontend"
|
"postinstall": "yarn resetPackagedPlugins && yarn build:lib && patch-package && yarn fillNativeModules && yarn build:plugins:frontend"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"concurrently": "^5.1.0",
|
"concurrently": "^5.1.0",
|
||||||
|
|||||||
@@ -9,10 +9,17 @@ const requirePlugin = require('../shell/requirePlugin');
|
|||||||
const downloadPackage = require('../utility/downloadPackage');
|
const downloadPackage = require('../utility/downloadPackage');
|
||||||
const hasPermission = require('../utility/hasPermission');
|
const hasPermission = require('../utility/hasPermission');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
const packagedPluginsContent = require('../packagedPluginsContent');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
script_meta: 'get',
|
script_meta: 'get',
|
||||||
async script({ packageName }) {
|
async script({ packageName }) {
|
||||||
|
const packagedContent = packagedPluginsContent();
|
||||||
|
|
||||||
|
if (packagedContent && packagedContent[packageName]) {
|
||||||
|
return packagedContent[packageName].frontend;
|
||||||
|
}
|
||||||
|
|
||||||
const file1 = path.join(packagedPluginsDir(), packageName, 'dist', 'frontend.js');
|
const file1 = path.join(packagedPluginsDir(), packageName, 'dist', 'frontend.js');
|
||||||
const file2 = path.join(pluginsdir(), packageName, 'dist', 'frontend.js');
|
const file2 = path.join(pluginsdir(), packageName, 'dist', 'frontend.js');
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@@ -58,13 +65,23 @@ module.exports = {
|
|||||||
|
|
||||||
installed_meta: 'get',
|
installed_meta: 'get',
|
||||||
async installed() {
|
async installed() {
|
||||||
const files1 = await fs.readdir(packagedPluginsDir());
|
const packagedContent = packagedPluginsContent();
|
||||||
|
|
||||||
|
const files1 = packagedContent ? _.keys(packagedContent) : await fs.readdir(packagedPluginsDir());
|
||||||
const files2 = await fs.readdir(pluginsdir());
|
const files2 = await fs.readdir(pluginsdir());
|
||||||
|
|
||||||
const res = [];
|
const res = [];
|
||||||
for (const packageName of _.union(files1, files2)) {
|
for (const packageName of _.union(files1, files2)) {
|
||||||
if (!/^dbgate-plugin-.*$/.test(packageName)) continue;
|
if (!/^dbgate-plugin-.*$/.test(packageName)) continue;
|
||||||
try {
|
try {
|
||||||
|
if (packagedContent && packagedContent[packageName]) {
|
||||||
|
const manifest = {
|
||||||
|
...packagedContent[packageName].manifest,
|
||||||
|
};
|
||||||
|
manifest.isPackaged = true;
|
||||||
|
manifest.readme = packagedContent[packageName].readme;
|
||||||
|
res.push(manifest);
|
||||||
|
} else {
|
||||||
const isPackaged = files1.includes(packageName);
|
const isPackaged = files1.includes(packageName);
|
||||||
const manifest = await fs
|
const manifest = await fs
|
||||||
.readFile(path.join(isPackaged ? packagedPluginsDir() : pluginsdir(), packageName, 'package.json'), {
|
.readFile(path.join(isPackaged ? packagedPluginsDir() : pluginsdir(), packageName, 'package.json'), {
|
||||||
@@ -78,6 +95,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
manifest.isPackaged = isPackaged;
|
manifest.isPackaged = isPackaged;
|
||||||
res.push(manifest);
|
res.push(manifest);
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(`Skipped plugin ${packageName}, error:`, err.message);
|
console.log(`Skipped plugin ${packageName}, error:`, err.message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
const shell = require('./shell');
|
const shell = require('./shell');
|
||||||
const processArgs = require('./utility/processArgs');
|
const processArgs = require('./utility/processArgs');
|
||||||
|
const dbgateTools = require('dbgate-tools');
|
||||||
|
|
||||||
|
global['DBGATE_TOOLS'] = dbgateTools;
|
||||||
|
|
||||||
if (processArgs.startProcess) {
|
if (processArgs.startProcess) {
|
||||||
const proc = require('./proc');
|
const proc = require('./proc');
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { DatabaseInfo, DatabaseModification, EngineDriver } from 'dbgate-types';
|
|||||||
import _sortBy from 'lodash/sortBy';
|
import _sortBy from 'lodash/sortBy';
|
||||||
import _groupBy from 'lodash/groupBy';
|
import _groupBy from 'lodash/groupBy';
|
||||||
import _pick from 'lodash/pick';
|
import _pick from 'lodash/pick';
|
||||||
import _ from 'lodash';
|
import _compact from 'lodash/compact';
|
||||||
|
|
||||||
const fp_pick = arg => array => _pick(array, arg);
|
const fp_pick = arg => array => _pick(array, arg);
|
||||||
export class DatabaseAnalyser {
|
export class DatabaseAnalyser {
|
||||||
@@ -134,7 +134,7 @@ export class DatabaseAnalyser {
|
|||||||
return this.structure[objectTypeField]
|
return this.structure[objectTypeField]
|
||||||
.filter(x => !items.find(y => x.objectId == y.objectId))
|
.filter(x => !items.find(y => x.objectId == y.objectId))
|
||||||
.map(x => ({
|
.map(x => ({
|
||||||
oldName: _.pick(x, ['schemaName', 'pureName']),
|
oldName: _pick(x, ['schemaName', 'pureName']),
|
||||||
objectId: x.objectId,
|
objectId: x.objectId,
|
||||||
action: 'remove',
|
action: 'remove',
|
||||||
objectTypeField,
|
objectTypeField,
|
||||||
@@ -175,7 +175,7 @@ export class DatabaseAnalyser {
|
|||||||
const action = obj
|
const action = obj
|
||||||
? {
|
? {
|
||||||
newName: { schemaName, pureName },
|
newName: { schemaName, pureName },
|
||||||
oldName: _.pick(obj, ['schemaName', 'pureName']),
|
oldName: _pick(obj, ['schemaName', 'pureName']),
|
||||||
action: 'change',
|
action: 'change',
|
||||||
objectTypeField: field,
|
objectTypeField: field,
|
||||||
objectId,
|
objectId,
|
||||||
@@ -189,7 +189,7 @@ export class DatabaseAnalyser {
|
|||||||
res.push(action);
|
res.push(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [..._.compact(res), ...this.getDeletedObjects(snapshot)];
|
return [..._compact(res), ...this.getDeletedObjects(snapshot)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import {
|
|||||||
TriggerInfo,
|
TriggerInfo,
|
||||||
ViewInfo,
|
ViewInfo,
|
||||||
} from 'dbgate-types';
|
} from 'dbgate-types';
|
||||||
import _ from 'lodash';
|
import _flatten from 'lodash/flatten';
|
||||||
|
import _uniqBy from 'lodash/uniqBy'
|
||||||
import { SqlDumper } from './SqlDumper';
|
import { SqlDumper } from './SqlDumper';
|
||||||
import { extendDatabaseInfo } from './structureTools';
|
import { extendDatabaseInfo } from './structureTools';
|
||||||
|
|
||||||
@@ -122,9 +123,9 @@ export class SqlGenerator {
|
|||||||
|
|
||||||
createForeignKeys() {
|
createForeignKeys() {
|
||||||
const fks = [];
|
const fks = [];
|
||||||
if (this.options.createForeignKeys) fks.push(..._.flatten(this.tables.map(x => x.foreignKeys || [])));
|
if (this.options.createForeignKeys) fks.push(..._flatten(this.tables.map(x => x.foreignKeys || [])));
|
||||||
if (this.options.createReferences) fks.push(..._.flatten(this.tables.map(x => x.dependencies || [])));
|
if (this.options.createReferences) fks.push(..._flatten(this.tables.map(x => x.dependencies || [])));
|
||||||
for (const fk of _.uniqBy(fks, 'constraintName')) {
|
for (const fk of _uniqBy(fks, 'constraintName')) {
|
||||||
this.dmp.createForeignKey(fk);
|
this.dmp.createForeignKey(fk);
|
||||||
if (this.checkDumper()) return;
|
if (this.checkDumper()) return;
|
||||||
}
|
}
|
||||||
@@ -152,7 +153,7 @@ export class SqlGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.options.createIndexes) {
|
if (this.options.createIndexes) {
|
||||||
for (const index of _.flatten(this.tables.map(x => x.indexes || []))) {
|
for (const index of _flatten(this.tables.map(x => x.indexes || []))) {
|
||||||
this.dmp.createIndex(index);
|
this.dmp.createIndex(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -204,7 +205,7 @@ export class SqlGenerator {
|
|||||||
|
|
||||||
dropTables() {
|
dropTables() {
|
||||||
if (this.options.dropReferences) {
|
if (this.options.dropReferences) {
|
||||||
for (const fk of _.flatten(this.tables.map(x => x.dependencies || []))) {
|
for (const fk of _flatten(this.tables.map(x => x.dependencies || []))) {
|
||||||
this.dmp.dropForeignKey(fk);
|
this.dmp.dropForeignKey(fk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
import _ from 'lodash';
|
import _isNaN from 'lodash/isNaN';
|
||||||
|
import _isNumber from 'lodash/isNumber';
|
||||||
|
|
||||||
export function extractIntSettingsValue(settings, name, defaultValue, min = null, max = null) {
|
export function extractIntSettingsValue(settings, name, defaultValue, min = null, max = null) {
|
||||||
const parsed = parseInt(settings[name]);
|
const parsed = parseInt(settings[name]);
|
||||||
if (_.isNaN(parsed)) {
|
if (_isNaN(parsed)) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (_.isNumber(parsed)) {
|
if (_isNumber(parsed)) {
|
||||||
if (min != null && parsed < min) return min;
|
if (min != null && parsed < min) return min;
|
||||||
if (max != null && parsed > max) return max;
|
if (max != null && parsed > max) return max;
|
||||||
return parsed;
|
return parsed;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { DatabaseInfo } from 'dbgate-types';
|
import { DatabaseInfo } from 'dbgate-types';
|
||||||
import _ from 'lodash';
|
import _flatten from 'lodash/flatten';
|
||||||
|
|
||||||
export function addTableDependencies(db: DatabaseInfo): DatabaseInfo {
|
export function addTableDependencies(db: DatabaseInfo): DatabaseInfo {
|
||||||
const allForeignKeys = _.flatten(db.tables.map(x => x.foreignKeys || []));
|
const allForeignKeys = _flatten(db.tables.map(x => x.foreignKeys || []));
|
||||||
return {
|
return {
|
||||||
...db,
|
...db,
|
||||||
tables: db.tables.map(table => ({
|
tables: db.tables.map(table => ({
|
||||||
|
|||||||
@@ -21,9 +21,25 @@
|
|||||||
<link rel='stylesheet' href='build/fonts/materialdesignicons.css'>
|
<link rel='stylesheet' href='build/fonts/materialdesignicons.css'>
|
||||||
|
|
||||||
<script defer src='build/bundle.js'></script>
|
<script defer src='build/bundle.js'></script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
#starting_dbgate_zero {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-around;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<div id='starting_dbgate_zero'>
|
||||||
|
Loading DbGate App ...
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -33,6 +33,11 @@
|
|||||||
|
|
||||||
onMount(loadApi);
|
onMount(loadApi);
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
const removed = document.getElementById('starting_dbgate_zero');
|
||||||
|
if (removed) removed.remove();
|
||||||
|
});
|
||||||
|
|
||||||
$: {
|
$: {
|
||||||
if (loadedApi && $loadingPluginStore?.loaded) {
|
if (loadedApi && $loadingPluginStore?.loaded) {
|
||||||
setAppLoaded();
|
setAppLoaded();
|
||||||
@@ -51,7 +56,12 @@
|
|||||||
<OpenTabsOnStartup />
|
<OpenTabsOnStartup />
|
||||||
<Screen />
|
<Screen />
|
||||||
{:else}
|
{:else}
|
||||||
<LoadingInfo message={`Loading plugin ${$loadingPluginStore.loadingPackageName}`} wrapper />
|
<LoadingInfo
|
||||||
|
message={$loadingPluginStore.loadingPackageName
|
||||||
|
? `Loading plugin ${$loadingPluginStore.loadingPackageName} ...`
|
||||||
|
: 'Preparing plugins ...'}
|
||||||
|
wrapper
|
||||||
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
<LoadingInfo message="Starting DbGate ..." wrapper />
|
<LoadingInfo message="Starting DbGate ..." wrapper />
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
async function loadPlugins(pluginsDict, installedPlugins) {
|
async function loadPlugins(pluginsDict, installedPlugins) {
|
||||||
|
window['DBGATE_TOOLS'] = dbgateTools;
|
||||||
|
|
||||||
const newPlugins = {};
|
const newPlugins = {};
|
||||||
for (const installed of installedPlugins || []) {
|
for (const installed of installedPlugins || []) {
|
||||||
if (!_.keys(pluginsDict).includes(installed.name)) {
|
if (!_.keys(pluginsDict).includes(installed.name)) {
|
||||||
@@ -63,6 +65,7 @@
|
|||||||
import { useInstalledPlugins } from '../utility/metadataLoaders';
|
import { useInstalledPlugins } from '../utility/metadataLoaders';
|
||||||
import { buildFileFormats } from './fileformats';
|
import { buildFileFormats } from './fileformats';
|
||||||
import { buildThemes } from './themes';
|
import { buildThemes } from './themes';
|
||||||
|
import dbgateTools from 'dbgate-tools';
|
||||||
|
|
||||||
let pluginsDict = {};
|
let pluginsDict = {};
|
||||||
const installedPlugins = useInstalledPlugins();
|
const installedPlugins = useInstalledPlugins();
|
||||||
|
|||||||
@@ -15,6 +15,12 @@ var config = {
|
|||||||
library: 'plugin',
|
library: 'plugin',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
|
||||||
// uncomment for disable minimalization
|
// uncomment for disable minimalization
|
||||||
// optimization: {
|
// optimization: {
|
||||||
// minimize: false,
|
// minimize: false,
|
||||||
|
|||||||
@@ -15,6 +15,12 @@ var config = {
|
|||||||
library: 'plugin',
|
library: 'plugin',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
|
||||||
// uncomment for disable minimalization
|
// uncomment for disable minimalization
|
||||||
// optimization: {
|
// optimization: {
|
||||||
// minimize: false,
|
// minimize: false,
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
const { SqlDumper } = require('dbgate-tools');
|
const { SqlDumper } = global.DBGATE_TOOLS;
|
||||||
|
|
||||||
class Dumper extends SqlDumper {
|
class Dumper extends SqlDumper {}
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Dumper;
|
module.exports = Dumper;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const { driverBase } = require('dbgate-tools');
|
const { driverBase } = global.DBGATE_TOOLS;
|
||||||
const Dumper = require('./Dumper');
|
const Dumper = require('./Dumper');
|
||||||
|
|
||||||
const mongoIdRegex = /^[0-9a-f]{24}$/;
|
const mongoIdRegex = /^[0-9a-f]{24}$/;
|
||||||
|
|||||||
@@ -15,6 +15,12 @@ var config = {
|
|||||||
library: 'plugin',
|
library: 'plugin',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
|
||||||
// uncomment for disable minimalization
|
// uncomment for disable minimalization
|
||||||
// optimization: {
|
// optimization: {
|
||||||
// minimize: false,
|
// minimize: false,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const { SqlDumper } = require('dbgate-tools');
|
const { SqlDumper } = global.DBGATE_TOOLS;
|
||||||
|
|
||||||
class MsSqlDumper extends SqlDumper {
|
class MsSqlDumper extends SqlDumper {
|
||||||
autoIncrement() {
|
autoIncrement() {
|
||||||
@@ -67,12 +67,12 @@ class MsSqlDumper extends SqlDumper {
|
|||||||
|
|
||||||
dropDefault(col) {
|
dropDefault(col) {
|
||||||
if (col.defaultConstraint) {
|
if (col.defaultConstraint) {
|
||||||
this.putCmd("^alter ^table %f ^drop ^constraint %i", col, col.defaultConstraint);
|
this.putCmd('^alter ^table %f ^drop ^constraint %i', col, col.defaultConstraint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
guessDefaultName(col) {
|
guessDefaultName(col) {
|
||||||
return col.defaultConstraint || `DF${col.schemaName || 'dbo'}_${col.pureName}_col.columnName`
|
return col.defaultConstraint || `DF${col.schemaName || 'dbo'}_${col.pureName}_col.columnName`;
|
||||||
}
|
}
|
||||||
|
|
||||||
createDefault(col) {
|
createDefault(col) {
|
||||||
@@ -80,7 +80,7 @@ class MsSqlDumper extends SqlDumper {
|
|||||||
const defsql = col.defaultValue;
|
const defsql = col.defaultValue;
|
||||||
if (!defsql) {
|
if (!defsql) {
|
||||||
const defname = this.guessDefaultName(col);
|
const defname = this.guessDefaultName(col);
|
||||||
this.putCmd("^alter ^table %f ^add ^constraint %i ^default %s for %i", col, defname, defsql, col.columnName);
|
this.putCmd('^alter ^table %f ^add ^constraint %i ^default %s for %i', col, defname, defsql, col.columnName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,8 +89,14 @@ class MsSqlDumper extends SqlDumper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renameConstraint(cnt, newname) {
|
renameConstraint(cnt, newname) {
|
||||||
if (cnt.constraintType == 'index') this.putCmd("^execute sp_rename '%f.%i', '%s', 'INDEX'", cnt, cnt.constraintName, newname);
|
if (cnt.constraintType == 'index')
|
||||||
else this.putCmd("^execute sp_rename '%f', '%s', 'OBJECT'", { schemaName: cnt.schemaName, pureName: cnt.constraintName }, newname);
|
this.putCmd("^execute sp_rename '%f.%i', '%s', 'INDEX'", cnt, cnt.constraintName, newname);
|
||||||
|
else
|
||||||
|
this.putCmd(
|
||||||
|
"^execute sp_rename '%f', '%s', 'OBJECT'",
|
||||||
|
{ schemaName: cnt.schemaName, pureName: cnt.constraintName },
|
||||||
|
newname
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,5 +115,4 @@ MsSqlDumper.prototype.changeTriggerSchema = MsSqlDumper.prototype.changeObjectSc
|
|||||||
MsSqlDumper.prototype.renameTable = MsSqlDumper.prototype.renameObject;
|
MsSqlDumper.prototype.renameTable = MsSqlDumper.prototype.renameObject;
|
||||||
MsSqlDumper.prototype.changeTableSchema = MsSqlDumper.prototype.changeObjectSchema;
|
MsSqlDumper.prototype.changeTableSchema = MsSqlDumper.prototype.changeObjectSchema;
|
||||||
|
|
||||||
|
|
||||||
module.exports = MsSqlDumper;
|
module.exports = MsSqlDumper;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const { driverBase } = require('dbgate-tools');
|
const { driverBase } = global.DBGATE_TOOLS;
|
||||||
const MsSqlDumper = require('./MsSqlDumper');
|
const MsSqlDumper = require('./MsSqlDumper');
|
||||||
|
|
||||||
/** @type {import('dbgate-types').SqlDialect} */
|
/** @type {import('dbgate-types').SqlDialect} */
|
||||||
|
|||||||
@@ -15,6 +15,12 @@ var config = {
|
|||||||
library: 'plugin',
|
library: 'plugin',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
|
||||||
// optimization: {
|
// optimization: {
|
||||||
// minimize: false,
|
// minimize: false,
|
||||||
// },
|
// },
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const { SqlDumper } = require('dbgate-tools');
|
const { SqlDumper } = global.DBGATE_TOOLS;
|
||||||
|
|
||||||
class Dumper extends SqlDumper {
|
class Dumper extends SqlDumper {
|
||||||
/** @param type {import('dbgate-types').TransformType} */
|
/** @param type {import('dbgate-types').TransformType} */
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const { driverBase } = require('dbgate-tools');
|
const { driverBase } = global.DBGATE_TOOLS;
|
||||||
const Dumper = require('./Dumper');
|
const Dumper = require('./Dumper');
|
||||||
|
|
||||||
/** @type {import('dbgate-types').SqlDialect} */
|
/** @type {import('dbgate-types').SqlDialect} */
|
||||||
|
|||||||
@@ -15,6 +15,12 @@ var config = {
|
|||||||
library: 'plugin',
|
library: 'plugin',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
|
||||||
// uncomment for disable minimalization
|
// uncomment for disable minimalization
|
||||||
// optimization: {
|
// optimization: {
|
||||||
// minimize: false,
|
// minimize: false,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const { SqlDumper } = require('dbgate-tools');
|
const { SqlDumper } = global.DBGATE_TOOLS;
|
||||||
|
|
||||||
class Dumper extends SqlDumper {
|
class Dumper extends SqlDumper {
|
||||||
/** @param type {import('dbgate-types').TransformType} */
|
/** @param type {import('dbgate-types').TransformType} */
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const { driverBase } = require('dbgate-tools');
|
const { driverBase } = global.DBGATE_TOOLS;
|
||||||
const Dumper = require('./Dumper');
|
const Dumper = require('./Dumper');
|
||||||
|
|
||||||
/** @type {import('dbgate-types').SqlDialect} */
|
/** @type {import('dbgate-types').SqlDialect} */
|
||||||
|
|||||||
@@ -1,20 +1,26 @@
|
|||||||
var webpack = require("webpack");
|
var webpack = require('webpack');
|
||||||
var path = require("path");
|
var path = require('path');
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
context: __dirname + "/src/frontend",
|
context: __dirname + '/src/frontend',
|
||||||
|
|
||||||
entry: {
|
entry: {
|
||||||
app: "./index.js",
|
app: './index.js',
|
||||||
},
|
},
|
||||||
target: "web",
|
target: 'web',
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve(__dirname, "dist"),
|
path: path.resolve(__dirname, 'dist'),
|
||||||
filename: "frontend.js",
|
filename: 'frontend.js',
|
||||||
libraryTarget: "var",
|
libraryTarget: 'var',
|
||||||
library: 'plugin',
|
library: 'plugin',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
|
||||||
// uncomment for disable minimalization
|
// uncomment for disable minimalization
|
||||||
// optimization: {
|
// optimization: {
|
||||||
// minimize: false,
|
// minimize: false,
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "dbgate-plugin-sqlite",
|
"name": "dbgate-plugin-sqlite",
|
||||||
"main": "dist/backend.js",
|
"main": "dist/backend.js",
|
||||||
"version": "1.0.0",
|
"version": "4.1.1",
|
||||||
|
"homepage": "https://dbgate.org",
|
||||||
|
"description": "SQLite connect plugin for DbGate",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/dbgate/dbgate"
|
||||||
|
},
|
||||||
|
"author": "Jan Prochazka",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"dbgate",
|
"dbgate",
|
||||||
@@ -9,7 +16,8 @@
|
|||||||
"sqlite"
|
"sqlite"
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist",
|
||||||
|
"icon.svg"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:frontend": "webpack --config webpack-frontend.config",
|
"build:frontend": "webpack --config webpack-frontend.config",
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
const { SqlDumper } = require('dbgate-tools');
|
const { SqlDumper } = global.DBGATE_TOOLS;
|
||||||
|
|
||||||
class Dumper extends SqlDumper {
|
class Dumper extends SqlDumper {}
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Dumper;
|
module.exports = Dumper;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const { driverBase } = require('dbgate-tools');
|
const { driverBase } = global.DBGATE_TOOLS;
|
||||||
const Dumper = require('./Dumper');
|
const Dumper = require('./Dumper');
|
||||||
|
|
||||||
function getDatabaseFileLabel(databaseFile) {
|
function getDatabaseFileLabel(databaseFile) {
|
||||||
|
|||||||
@@ -1,20 +1,26 @@
|
|||||||
var webpack = require("webpack");
|
var webpack = require('webpack');
|
||||||
var path = require("path");
|
var path = require('path');
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
context: __dirname + "/src/frontend",
|
context: __dirname + '/src/frontend',
|
||||||
|
|
||||||
entry: {
|
entry: {
|
||||||
app: "./index.js",
|
app: './index.js',
|
||||||
},
|
},
|
||||||
target: "web",
|
target: 'web',
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve(__dirname, "dist"),
|
path: path.resolve(__dirname, 'dist'),
|
||||||
filename: "frontend.js",
|
filename: 'frontend.js',
|
||||||
libraryTarget: "var",
|
libraryTarget: 'var',
|
||||||
library: 'plugin',
|
library: 'plugin',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
|
||||||
// uncomment for disable minimalization
|
// uncomment for disable minimalization
|
||||||
// optimization: {
|
// optimization: {
|
||||||
// minimize: false,
|
// minimize: false,
|
||||||
|
|||||||
3
resetPackagedPlugins.js
Normal file
3
resetPackagedPlugins.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
fs.writeFileSync('packages/api/src/packagedPluginsContent.js', `module.exports = () => null;`);
|
||||||
@@ -46,3 +46,4 @@ changePackageFile('plugins/dbgate-plugin-mssql', json.version);
|
|||||||
changePackageFile('plugins/dbgate-plugin-mysql', json.version);
|
changePackageFile('plugins/dbgate-plugin-mysql', json.version);
|
||||||
changePackageFile('plugins/dbgate-plugin-mongo', json.version);
|
changePackageFile('plugins/dbgate-plugin-mongo', json.version);
|
||||||
changePackageFile('plugins/dbgate-plugin-postgres', json.version);
|
changePackageFile('plugins/dbgate-plugin-postgres', json.version);
|
||||||
|
changePackageFile('plugins/dbgate-plugin-sqlite', json.version);
|
||||||
|
|||||||
Reference in New Issue
Block a user