This commit is contained in:
Jan Prochazka
2021-06-30 16:15:13 +02:00
parent 4c1ac0757c
commit f415c8bfe9
2 changed files with 18 additions and 2 deletions

View File

@@ -1,10 +1,23 @@
const stableStringify = require('json-stable-stringify');
const _ = require('lodash');
const fp = require('lodash/fp');
const uuidv1 = require('uuid/v1');
const { testWrapper } = require('../tools');
const engines = require('../engines');
const { getAlterTableScript, extendDatabaseInfo } = require('dbgate-tools');
function pickImportantTableInfo(table) {
return {
pureName: table.pureName,
columns: table.columns.map(fp.pick(['columnName', 'notNull', 'autoIncrement'])),
};
}
function checkTableStructure(t1, t2) {
// expect(t1.pureName).toEqual(t2.pureName)
expect(pickImportantTableInfo(t1)).toEqual(pickImportantTableInfo(t2));
}
async function testTableDiff(conn, driver, mangle) {
await driver.query(conn, 'create table t1 (col1 int not null)');
@@ -20,7 +33,8 @@ async function testTableDiff(conn, driver, mangle) {
const structure2Real = extendDatabaseInfo(await driver.analyseFull(conn));
expect(stableStringify(structure2)).toEqual(stableStringify(structure2Real));
checkTableStructure(structure2Real.tables[0], structure2.tables[0]);
// expect(stableStringify(structure2)).toEqual(stableStringify(structure2Real));
}
describe('Alter processor', () => {
@@ -32,6 +46,8 @@ describe('Alter processor', () => {
columnName: 'added',
dataType: 'int',
pairingId: uuidv1(),
notNull: false,
autoIncrement: false,
})
);
// console.log('ENGINE', engine);

View File

@@ -46,7 +46,7 @@
/>
<FormCheckboxField name="dataGrid.showHintColumns" label="Show foreign key hints" defaultValue={true} />
<FormCheckboxField name="dataGrid.thousandsSeparator" label="Use thounds separator for numbers" />
<FormCheckboxField name="dataGrid.thousandsSeparator" label="Use thousands separator for numbers" />
<div class="heading">Connection</div>
<FormCheckboxField