mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-26 17:55:59 +00:00
view columns test + try to fix
This commit is contained in:
@@ -13,6 +13,14 @@ function flatSource() {
|
|||||||
const obj1Match = expect.objectContaining({
|
const obj1Match = expect.objectContaining({
|
||||||
pureName: 'obj1',
|
pureName: 'obj1',
|
||||||
});
|
});
|
||||||
|
const view1Match = expect.objectContaining({
|
||||||
|
pureName: 'obj1',
|
||||||
|
columns: [
|
||||||
|
expect.objectContaining({
|
||||||
|
columnName: 'id',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
describe('Object analyse', () => {
|
describe('Object analyse', () => {
|
||||||
test.each(flatSource())(
|
test.each(flatSource())(
|
||||||
@@ -24,7 +32,7 @@ describe('Object analyse', () => {
|
|||||||
const structure = await driver.analyseFull(conn);
|
const structure = await driver.analyseFull(conn);
|
||||||
|
|
||||||
expect(structure[type].length).toEqual(1);
|
expect(structure[type].length).toEqual(1);
|
||||||
expect(structure[type][0]).toEqual(obj1Match);
|
expect(structure[type][0]).toEqual(type == 'views' ? view1Match : obj1Match);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -39,7 +47,7 @@ describe('Object analyse', () => {
|
|||||||
const structure2 = await driver.analyseIncremental(conn, structure1);
|
const structure2 = await driver.analyseIncremental(conn, structure1);
|
||||||
|
|
||||||
expect(structure2[type].length).toEqual(2);
|
expect(structure2[type].length).toEqual(2);
|
||||||
expect(structure2[type].find(x => x.pureName == 'obj1')).toEqual(obj1Match);
|
expect(structure2[type].find(x => x.pureName == 'obj1')).toEqual(type == 'views' ? view1Match : obj1Match);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -55,7 +63,7 @@ describe('Object analyse', () => {
|
|||||||
const structure2 = await driver.analyseIncremental(conn, structure1);
|
const structure2 = await driver.analyseIncremental(conn, structure1);
|
||||||
|
|
||||||
expect(structure2[type].length).toEqual(1);
|
expect(structure2[type].length).toEqual(1);
|
||||||
expect(structure2[type][0]).toEqual(obj1Match);
|
expect(structure2[type][0]).toEqual(type == 'views' ? view1Match : obj1Match);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -75,8 +83,7 @@ describe('Object analyse', () => {
|
|||||||
const structure3 = await driver.analyseIncremental(conn, structure2);
|
const structure3 = await driver.analyseIncremental(conn, structure2);
|
||||||
|
|
||||||
expect(structure3[type].length).toEqual(1);
|
expect(structure3[type].length).toEqual(1);
|
||||||
expect(structure3[type][0]).toEqual(obj1Match);
|
expect(structure3[type][0]).toEqual(type == 'views' ? view1Match : obj1Match);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ const engines = [
|
|||||||
server: 'localhost',
|
server: 'localhost',
|
||||||
port: 15003,
|
port: 15003,
|
||||||
},
|
},
|
||||||
// skipOnCI: true,
|
skipOnCI: true,
|
||||||
objects: [views],
|
objects: [views],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class Analyser extends DatabaseAnalyser {
|
|||||||
this.pool,
|
this.pool,
|
||||||
this.createQuery(this.driver.dialect.stringAgg ? 'tableModifications' : 'tableList', ['tables'])
|
this.createQuery(this.driver.dialect.stringAgg ? 'tableModifications' : 'tableList', ['tables'])
|
||||||
);
|
);
|
||||||
const columns = await this.driver.query(this.pool, this.createQuery('columns', ['tables']));
|
const columns = await this.driver.query(this.pool, this.createQuery('columns', ['tables', 'views']));
|
||||||
const pkColumns = await this.driver.query(this.pool, this.createQuery('primaryKeys', ['tables']));
|
const pkColumns = await this.driver.query(this.pool, this.createQuery('primaryKeys', ['tables']));
|
||||||
const fkColumns = await this.driver.query(this.pool, this.createQuery('foreignKeys', ['tables']));
|
const fkColumns = await this.driver.query(this.pool, this.createQuery('foreignKeys', ['tables']));
|
||||||
const views = await this.driver.query(this.pool, this.createQuery('views', ['views']));
|
const views = await this.driver.query(this.pool, this.createQuery('views', ['views']));
|
||||||
|
|||||||
Reference in New Issue
Block a user