Merge branch 'beforeUpdates'

This commit is contained in:
Jan Prochazka
2021-05-20 14:12:02 +02:00
37 changed files with 219 additions and 70 deletions

View File

@@ -15,6 +15,12 @@ var config = {
library: 'plugin',
},
plugins: [
new webpack.DefinePlugin({
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
}),
],
// uncomment for disable minimalization
// optimization: {
// minimize: false,

View File

@@ -15,6 +15,12 @@ var config = {
library: 'plugin',
},
plugins: [
new webpack.DefinePlugin({
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
}),
],
// uncomment for disable minimalization
// optimization: {
// minimize: false,

View File

@@ -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;

View File

@@ -1,4 +1,4 @@
const { driverBase } = require('dbgate-tools');
const { driverBase } = global.DBGATE_TOOLS;
const Dumper = require('./Dumper');
const mongoIdRegex = /^[0-9a-f]{24}$/;

View File

@@ -15,6 +15,12 @@ var config = {
library: 'plugin',
},
plugins: [
new webpack.DefinePlugin({
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
}),
],
// uncomment for disable minimalization
// optimization: {
// minimize: false,

View File

@@ -1,4 +1,4 @@
const { SqlDumper } = require('dbgate-tools');
const { SqlDumper } = global.DBGATE_TOOLS;
class MsSqlDumper extends SqlDumper {
autoIncrement() {
@@ -67,12 +67,12 @@ class MsSqlDumper extends SqlDumper {
dropDefault(col) {
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) {
return col.defaultConstraint || `DF${col.schemaName || 'dbo'}_${col.pureName}_col.columnName`
return col.defaultConstraint || `DF${col.schemaName || 'dbo'}_${col.pureName}_col.columnName`;
}
createDefault(col) {
@@ -80,7 +80,7 @@ class MsSqlDumper extends SqlDumper {
const defsql = col.defaultValue;
if (!defsql) {
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) {
if (cnt.constraintType == 'index') 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);
if (cnt.constraintType == 'index')
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.changeTableSchema = MsSqlDumper.prototype.changeObjectSchema;
module.exports = MsSqlDumper;

View File

@@ -1,4 +1,4 @@
const { driverBase } = require('dbgate-tools');
const { driverBase } = global.DBGATE_TOOLS;
const MsSqlDumper = require('./MsSqlDumper');
/** @type {import('dbgate-types').SqlDialect} */

View File

@@ -15,6 +15,12 @@ var config = {
library: 'plugin',
},
plugins: [
new webpack.DefinePlugin({
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
}),
],
// optimization: {
// minimize: false,
// },

View File

@@ -1,4 +1,4 @@
const { SqlDumper } = require('dbgate-tools');
const { SqlDumper } = global.DBGATE_TOOLS;
class Dumper extends SqlDumper {
/** @param type {import('dbgate-types').TransformType} */

View File

@@ -1,4 +1,4 @@
const { driverBase } = require('dbgate-tools');
const { driverBase } = global.DBGATE_TOOLS;
const Dumper = require('./Dumper');
/** @type {import('dbgate-types').SqlDialect} */

View File

@@ -15,6 +15,12 @@ var config = {
library: 'plugin',
},
plugins: [
new webpack.DefinePlugin({
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
}),
],
// uncomment for disable minimalization
// optimization: {
// minimize: false,

View File

@@ -1,4 +1,4 @@
const { SqlDumper } = require('dbgate-tools');
const { SqlDumper } = global.DBGATE_TOOLS;
class Dumper extends SqlDumper {
/** @param type {import('dbgate-types').TransformType} */

View File

@@ -1,4 +1,4 @@
const { driverBase } = require('dbgate-tools');
const { driverBase } = global.DBGATE_TOOLS;
const Dumper = require('./Dumper');
/** @type {import('dbgate-types').SqlDialect} */

View File

@@ -1,20 +1,26 @@
var webpack = require("webpack");
var path = require("path");
var webpack = require('webpack');
var path = require('path');
var config = {
context: __dirname + "/src/frontend",
context: __dirname + '/src/frontend',
entry: {
app: "./index.js",
app: './index.js',
},
target: "web",
target: 'web',
output: {
path: path.resolve(__dirname, "dist"),
filename: "frontend.js",
libraryTarget: "var",
path: path.resolve(__dirname, 'dist'),
filename: 'frontend.js',
libraryTarget: 'var',
library: 'plugin',
},
plugins: [
new webpack.DefinePlugin({
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
}),
],
// uncomment for disable minimalization
// optimization: {
// minimize: false,

View File

@@ -1,7 +1,14 @@
{
"name": "dbgate-plugin-sqlite",
"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",
"keywords": [
"dbgate",
@@ -9,7 +16,8 @@
"sqlite"
],
"files": [
"dist"
"dist",
"icon.svg"
],
"scripts": {
"build:frontend": "webpack --config webpack-frontend.config",

View File

@@ -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;

View File

@@ -1,4 +1,4 @@
const { driverBase } = require('dbgate-tools');
const { driverBase } = global.DBGATE_TOOLS;
const Dumper = require('./Dumper');
function getDatabaseFileLabel(databaseFile) {

View File

@@ -1,20 +1,26 @@
var webpack = require("webpack");
var path = require("path");
var webpack = require('webpack');
var path = require('path');
var config = {
context: __dirname + "/src/frontend",
context: __dirname + '/src/frontend',
entry: {
app: "./index.js",
app: './index.js',
},
target: "web",
target: 'web',
output: {
path: path.resolve(__dirname, "dist"),
filename: "frontend.js",
libraryTarget: "var",
path: path.resolve(__dirname, 'dist'),
filename: 'frontend.js',
libraryTarget: 'var',
library: 'plugin',
},
plugins: [
new webpack.DefinePlugin({
'global.DBGATE_TOOLS': 'window.DBGATE_TOOLS',
}),
],
// uncomment for disable minimalization
// optimization: {
// minimize: false,