diff --git a/packages/datalib/jest.config.js b/packages/datalib/jest.config.js new file mode 100644 index 000000000..790050941 --- /dev/null +++ b/packages/datalib/jest.config.js @@ -0,0 +1,5 @@ +module.exports = { + preset: 'ts-jest', + testEnvironment: 'node', + moduleFileExtensions: ['js'], +}; diff --git a/packages/datalib/package.json b/packages/datalib/package.json index ab79364fb..a625f4ef5 100644 --- a/packages/datalib/package.json +++ b/packages/datalib/package.json @@ -5,6 +5,7 @@ "typings": "lib/index.d.ts", "scripts": { "build": "tsc", + "test": "jest", "start": "tsc --watch" }, "files": [ @@ -18,6 +19,8 @@ "devDependencies": { "dbgate-types": "^5.0.0-alpha.1", "@types/node": "^13.7.0", + "jest": "^28.1.3", + "ts-jest": "^28.0.7", "typescript": "^4.4.3" } } \ No newline at end of file diff --git a/packages/datalib/src/PerspectiveDisplay.ts b/packages/datalib/src/PerspectiveDisplay.ts index 51d6a6c73..ea2599c05 100644 --- a/packages/datalib/src/PerspectiveDisplay.ts +++ b/packages/datalib/src/PerspectiveDisplay.ts @@ -7,9 +7,9 @@ import debug from 'debug'; const dbg = debug('dbgate:PerspectiveDisplay'); -const SKIP_CELL = { - __perspective_skip_cell__: true, -}; +// const SKIP_CELL = { +// __perspective_skip_cell__: true, +// }; let lastJoinId = 0; function getJoinId(): number { @@ -74,6 +74,7 @@ export class PerspectiveDisplayRow { this.rowData = _fill(Array(display.columns.length), undefined); this.rowSpans = _fill(Array(display.columns.length), 1); this.rowJoinIds = _fill(Array(display.columns.length), 0); + this.rowCellSkips = _fill(Array(display.columns.length), false); } getRow(rowIndex): PerspectiveDisplayRow { @@ -95,6 +96,8 @@ export class PerspectiveDisplayRow { rowData: any[] = []; rowSpans: number[] = null; + rowCellSkips: boolean[] = null; + rowJoinIds: number[] = []; incompleteRowsIndicator: string[] = null; } @@ -113,19 +116,19 @@ export class PerspectiveDisplay { this.columnLevelCount = _max(this.columns.map(x => x.parentNodes.length)) + 1; const collectedRows = this.collectRows(rows, root.childNodes); // dbg('collected rows', collectedRows); - // console.log('COLLECTED', collectedRows); + // console.log('COLLECTED', JSON.stringify(collectedRows, null, 2)); // this.mergeRows(collectedRows); this.mergeRows(collectedRows); // dbg('merged rows', this.rows); - // console.log( - // 'MERGED', - // this.rows.map(r => - // r.incompleteRowsIndicator - // ? `************************************ ${r.incompleteRowsIndicator.join('|')}` - // : r.rowData.join('|') - // ) - // ); + console.log( + 'MERGED', + this.rows.map(r => + r.incompleteRowsIndicator + ? `************************************ ${r.incompleteRowsIndicator.join('|')}` + : r.rowData.join('|') + ) + ); } fillColumns(children: PerspectiveTreeNode[], parentNodes: PerspectiveTreeNode[]) { @@ -212,7 +215,7 @@ export class PerspectiveDisplay { row.rowJoinIds[col] == this.rows[lastFilledRow].rowJoinIds[col] && row.rowJoinIds[col] ) { - row.rowData[col] = SKIP_CELL; + row.rowCellSkips[col] = true; this.rows[lastFilledRow].rowSpans[col] = rowIndex - lastFilledRow + 1; } else { lastFilledRow = rowIndex; @@ -229,6 +232,8 @@ export class PerspectiveDisplay { this.mergeRow(collectedRow, resultRow); rows.push(resultRow); } + // console.log('MERGED NOT FLAT', rows); + console.log('MERGED NOT FLAT SUBROWS 0', rows[0].subrows[0]); for (const row of rows) { this.flushFlatRows(row); } @@ -244,7 +249,7 @@ export class PerspectiveDisplay { } resultRow.incompleteRowsIndicator = collectedRow.incompleteRowsIndicator; - let subRowCount = 0; + // let subRowCount = 0; for (const subrows of collectedRow.subRowCollections) { let rowIndex = 0; for (const subrow of subrows.rows) { @@ -252,9 +257,9 @@ export class PerspectiveDisplay { this.mergeRow(subrow, targetRow); rowIndex++; } - if (rowIndex > subRowCount) { - subRowCount = rowIndex; - } + // if (rowIndex > subRowCount) { + // subRowCount = rowIndex; + // } } const joinId = getJoinId(); diff --git a/packages/datalib/src/tests/PerspectiveDisplay.test.ts b/packages/datalib/src/tests/PerspectiveDisplay.test.ts new file mode 100644 index 000000000..4d458f943 --- /dev/null +++ b/packages/datalib/src/tests/PerspectiveDisplay.test.ts @@ -0,0 +1,88 @@ +import { TableInfo } from 'dbgate-types'; +import { PerspectiveDisplay } from '../PerspectiveDisplay'; +import { PerspectiveTableNode } from '../PerspectiveTreeNode'; +import { chinookDbInfo } from './chinookDbInfo'; +import { createPerspectiveConfig } from '../PerspectiveConfig'; +import artistDataFlat from './artistDataFlat'; +import artistDataAlbum from './artistDataAlbum'; +import artistDataAlbumTrack from './artistDataAlbumTrack'; + +test('test flat view', () => { + const artistTable = chinookDbInfo.tables.find(x => x.pureName == 'Artist'); + const root = new PerspectiveTableNode(artistTable, chinookDbInfo, createPerspectiveConfig(), null, null, null, null); + const display = new PerspectiveDisplay(root, artistDataFlat); + + console.log(display.rows); + expect(display.rows.length).toEqual(5); + expect(display.rows[0]).toEqual( + expect.objectContaining({ + rowData: ['AC/DC'], + }) + ); +}); + +test('test one level nesting', () => { + const artistTable = chinookDbInfo.tables.find(x => x.pureName == 'Artist'); + const root = new PerspectiveTableNode( + artistTable, + chinookDbInfo, + { ...createPerspectiveConfig(), checkedColumns: ['Artist.Album'] }, + null, + null, + null, + null + ); + const display = new PerspectiveDisplay(root, artistDataAlbum); + + console.log(display.rows); + expect(display.rows.length).toEqual(7); + expect(display.rows[0]).toEqual( + expect.objectContaining({ + rowData: ['AC/DC', 'For Those About To Rock We Salute You'], + rowSpans: [2, 1], + rowCellSkips: [false, false], + }) + ); + expect(display.rows[1]).toEqual( + expect.objectContaining({ + rowData: [undefined, 'Let There Be Rock'], + rowSpans: [1, 1], + rowCellSkips: [true, false], + }) + ); + expect(display.rows[5]).toEqual( + expect.objectContaining({ + rowData: ['Alanis Morissette', 'Jagged Little Pill'], + rowSpans: [1, 1], + }) + ); +}); + +test('test two level nesting', () => { + const artistTable = chinookDbInfo.tables.find(x => x.pureName == 'Artist'); + const root = new PerspectiveTableNode( + artistTable, + chinookDbInfo, + { ...createPerspectiveConfig(), checkedColumns: ['Artist.Album', 'Artist.Album.Track'] }, + null, + null, + null, + null + ); + const display = new PerspectiveDisplay(root, artistDataAlbumTrack); + + console.log(display.rows); + expect(display.rows.length).toEqual(9); + // expect(display.rows[0]).toEqual( + // expect.objectContaining({ + // rowData: ['AC/DC', 'For Those About To Rock We Salute You'], + // rowSpans: [2, 1], + // }) + // ); + // expect(display.rows[5]).toEqual( + // expect.objectContaining({ + // rowData: ['Alanis Morissette', 'Jagged Little Pill'], + // rowSpans: [1, 1], + // }) + // ); +}); diff --git a/packages/datalib/src/tests/artistDataAlbum.ts b/packages/datalib/src/tests/artistDataAlbum.ts new file mode 100644 index 000000000..90c5d5cb0 --- /dev/null +++ b/packages/datalib/src/tests/artistDataAlbum.ts @@ -0,0 +1,55 @@ +export default [ + { + "ArtistId": 1, + "Name": "AC/DC", + "Album": [ + { + "Title": "For Those About To Rock We Salute You", + "ArtistId": 1 + }, + { + "Title": "Let There Be Rock", + "ArtistId": 1 + } + ] + }, + { + "ArtistId": 2, + "Name": "Accept", + "Album": [ + { + "Title": "Balls to the Wall", + "ArtistId": 2 + }, + { + "Title": "Restless and Wild", + "ArtistId": 2 + } + ] + }, + { + "ArtistId": 3, + "Name": "Aerosmith", + "Album": [ + { + "Title": "Big Ones", + "ArtistId": 3 + } + ] + }, + { + "ArtistId": 4, + "Name": "Alanis Morissette", + "Album": [ + { + "Title": "Jagged Little Pill", + "ArtistId": 4 + } + ] + }, + { + "incompleteRowsIndicator": [ + "Artist" + ] + } + ] \ No newline at end of file diff --git a/packages/datalib/src/tests/artistDataAlbumTrack.ts b/packages/datalib/src/tests/artistDataAlbumTrack.ts new file mode 100644 index 000000000..59aafd4a3 --- /dev/null +++ b/packages/datalib/src/tests/artistDataAlbumTrack.ts @@ -0,0 +1,78 @@ +export default [ + { + ArtistId: 1, + Name: 'AC/DC', + Album: [ + { + Title: 'For Those About To Rock We Salute You', + AlbumId: 1, + ArtistId: 1, + Track: [ + { + Name: 'For Those About To Rock (We Salute You)', + AlbumId: 1, + }, + { + Name: 'Put The Finger On You', + AlbumId: 1, + }, + ], + }, + { + Title: 'Let There Be Rock', + AlbumId: 4, + ArtistId: 1, + Track: [ + { + Name: 'Go Down', + AlbumId: 4, + }, + { + Name: 'Dog Eat Dog', + AlbumId: 4, + }, + ], + }, + ], + }, + { + ArtistId: 2, + Name: 'Accept', + Album: [ + { + Title: 'Balls to the Wall', + AlbumId: 2, + ArtistId: 2, + Track: [ + { + Name: 'Balls to the Wall', + AlbumId: 2, + }, + ], + }, + { + Title: 'Restless and Wild', + AlbumId: 3, + ArtistId: 2, + Track: [ + { + Name: 'Fast As a Shark', + AlbumId: 3, + }, + { + Name: 'Restless and Wild', + AlbumId: 3, + }, + { + Name: 'Princess of the Dawn', + AlbumId: 3, + }, + ], + }, + ], + }, + + { + incompleteRowsIndicator: ['Artist'], + }, +]; diff --git a/packages/datalib/src/tests/artistDataFlat.ts b/packages/datalib/src/tests/artistDataFlat.ts new file mode 100644 index 000000000..55f65af90 --- /dev/null +++ b/packages/datalib/src/tests/artistDataFlat.ts @@ -0,0 +1,21 @@ +export default [ + { + ArtistId: 1, + Name: 'AC/DC', + }, + { + ArtistId: 2, + Name: 'Accept', + }, + { + ArtistId: 3, + Name: 'Aerosmith', + }, + { + ArtistId: 4, + Name: 'Alanis Morissette', + }, + { + incompleteRowsIndicator: ['Artist'], + }, +]; diff --git a/packages/datalib/src/tests/chinookDbInfo.ts b/packages/datalib/src/tests/chinookDbInfo.ts new file mode 100644 index 000000000..20fbbb784 --- /dev/null +++ b/packages/datalib/src/tests/chinookDbInfo.ts @@ -0,0 +1,1777 @@ +import { DatabaseInfo } from 'dbgate-types'; + +export const chinookDbInfo: DatabaseInfo = { + tables: [ + { + pureName: 'Customer', + tableRowCount: '59', + modifyDate: '2022-04-09 09:26:46', + objectId: 'Customer', + contentHash: '2022-04-09 09:26:46', + columns: [ + { + pureName: 'Customer', + notNull: true, + autoIncrement: true, + columnName: 'CustomerId', + columnComment: '', + dataType: 'int', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Customer', + notNull: true, + autoIncrement: false, + columnName: 'FirstName', + columnComment: '', + dataType: 'varchar(40)', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Customer', + notNull: true, + autoIncrement: false, + columnName: 'LastName', + columnComment: '', + dataType: 'varchar(20)', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Customer', + notNull: false, + autoIncrement: false, + columnName: 'Company', + columnComment: '', + dataType: 'varchar(80)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Customer', + notNull: false, + autoIncrement: false, + columnName: 'Address', + columnComment: '', + dataType: 'varchar(70)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Customer', + notNull: false, + autoIncrement: false, + columnName: 'City', + columnComment: '', + dataType: 'varchar(40)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Customer', + notNull: false, + autoIncrement: false, + columnName: 'State', + columnComment: '', + dataType: 'varchar(40)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Customer', + notNull: false, + autoIncrement: false, + columnName: 'Country', + columnComment: '', + dataType: 'varchar(40)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Customer', + notNull: false, + autoIncrement: false, + columnName: 'PostalCode', + columnComment: '', + dataType: 'varchar(10)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Customer', + notNull: false, + autoIncrement: false, + columnName: 'Phone', + columnComment: '', + dataType: 'varchar(24)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Customer', + notNull: false, + autoIncrement: false, + columnName: 'Fax', + columnComment: '', + dataType: 'varchar(24)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Customer', + notNull: true, + autoIncrement: false, + columnName: 'Email', + columnComment: '', + dataType: 'varchar(60)', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Customer', + notNull: false, + autoIncrement: false, + columnName: 'SupportRepId', + columnComment: '', + dataType: 'int', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + ], + primaryKey: { + constraintName: 'PRIMARY', + pureName: 'Customer', + constraintType: 'primaryKey', + columns: [ + { + columnName: 'CustomerId', + }, + ], + }, + foreignKeys: [ + { + constraintName: 'FK_CustomerSupportRepId', + constraintType: 'foreignKey', + pureName: 'Customer', + refTableName: 'Employee', + updateAction: 'NO ACTION', + deleteAction: 'NO ACTION', + columns: [ + { + columnName: 'SupportRepId', + refColumnName: 'EmployeeId', + }, + ], + }, + ], + indexes: [ + { + constraintName: 'IFK_CustomerSupportRepId', + indexType: 'BTREE', + isUnique: false, + columns: [ + { + columnName: 'SupportRepId', + }, + ], + pureName: 'Customer', + constraintType: 'index', + }, + ], + uniques: [], + engine: 'mariadb@dbgate-plugin-mysql', + dependencies: [ + { + constraintName: 'FK_InvoiceCustomerId', + constraintType: 'foreignKey', + pureName: 'Invoice', + refTableName: 'Customer', + updateAction: 'NO ACTION', + deleteAction: 'NO ACTION', + columns: [ + { + columnName: 'CustomerId', + refColumnName: 'CustomerId', + }, + ], + }, + ], + objectTypeField: 'tables', + checks: [], + }, + { + pureName: 'Track', + tableRowCount: '3483', + modifyDate: '2022-04-09 09:26:46', + objectId: 'Track', + contentHash: '2022-04-09 09:26:46', + columns: [ + { + pureName: 'Track', + notNull: true, + autoIncrement: true, + columnName: 'TrackId', + columnComment: '', + dataType: 'int', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Track', + notNull: true, + autoIncrement: false, + columnName: 'Name', + columnComment: '', + dataType: 'varchar(200)', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Track', + notNull: false, + autoIncrement: false, + columnName: 'AlbumId', + columnComment: '', + dataType: 'int', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Track', + notNull: true, + autoIncrement: false, + columnName: 'MediaTypeId', + columnComment: '', + dataType: 'int', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Track', + notNull: false, + autoIncrement: false, + columnName: 'GenreId', + columnComment: '', + dataType: 'int', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Track', + notNull: false, + autoIncrement: false, + columnName: 'Composer', + columnComment: '', + dataType: 'varchar(220)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Track', + notNull: true, + autoIncrement: false, + columnName: 'Milliseconds', + columnComment: '', + dataType: 'int', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Track', + notNull: false, + autoIncrement: false, + columnName: 'Bytes', + columnComment: '', + dataType: 'int', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Track', + notNull: true, + autoIncrement: false, + columnName: 'UnitPrice', + columnComment: '', + dataType: 'decimal(10,2)', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + ], + primaryKey: { + constraintName: 'PRIMARY', + pureName: 'Track', + constraintType: 'primaryKey', + columns: [ + { + columnName: 'TrackId', + }, + ], + }, + foreignKeys: [ + { + constraintName: 'FK_TrackMediaTypeId', + constraintType: 'foreignKey', + pureName: 'Track', + refTableName: 'MediaType', + updateAction: 'NO ACTION', + deleteAction: 'NO ACTION', + columns: [ + { + columnName: 'MediaTypeId', + refColumnName: 'MediaTypeId', + }, + ], + }, + { + constraintName: 'FK_TrackAlbumId', + constraintType: 'foreignKey', + pureName: 'Track', + refTableName: 'Album', + updateAction: 'NO ACTION', + deleteAction: 'NO ACTION', + columns: [ + { + columnName: 'AlbumId', + refColumnName: 'AlbumId', + }, + ], + }, + { + constraintName: 'FK_TrackGenreId', + constraintType: 'foreignKey', + pureName: 'Track', + refTableName: 'Genre', + updateAction: 'NO ACTION', + deleteAction: 'NO ACTION', + columns: [ + { + columnName: 'GenreId', + refColumnName: 'GenreId', + }, + ], + }, + ], + indexes: [ + { + constraintName: 'IFK_TrackGenreId', + indexType: 'BTREE', + isUnique: false, + columns: [ + { + columnName: 'GenreId', + }, + ], + pureName: 'Track', + constraintType: 'index', + }, + { + constraintName: 'IFK_TrackMediaTypeId', + indexType: 'BTREE', + isUnique: false, + columns: [ + { + columnName: 'MediaTypeId', + }, + ], + pureName: 'Track', + constraintType: 'index', + }, + { + constraintName: 'IFK_TrackAlbumId', + indexType: 'BTREE', + isUnique: false, + columns: [ + { + columnName: 'AlbumId', + }, + ], + pureName: 'Track', + constraintType: 'index', + }, + ], + uniques: [], + engine: 'mariadb@dbgate-plugin-mysql', + dependencies: [ + { + constraintName: 'FK_InvoiceLineTrackId', + constraintType: 'foreignKey', + pureName: 'InvoiceLine', + refTableName: 'Track', + updateAction: 'NO ACTION', + deleteAction: 'NO ACTION', + columns: [ + { + columnName: 'TrackId', + refColumnName: 'TrackId', + }, + ], + }, + { + constraintName: 'FK_PlaylistTrackTrackId', + constraintType: 'foreignKey', + pureName: 'PlaylistTrack', + refTableName: 'Track', + updateAction: 'NO ACTION', + deleteAction: 'NO ACTION', + columns: [ + { + columnName: 'TrackId', + refColumnName: 'TrackId', + }, + ], + }, + ], + objectTypeField: 'tables', + checks: [], + }, + { + pureName: 'InvoiceLine', + tableRowCount: '2240', + modifyDate: '2022-04-09 09:26:46', + objectId: 'InvoiceLine', + contentHash: '2022-04-09 09:26:46', + columns: [ + { + pureName: 'InvoiceLine', + notNull: true, + autoIncrement: true, + columnName: 'InvoiceLineId', + columnComment: '', + dataType: 'int', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'InvoiceLine', + notNull: true, + autoIncrement: false, + columnName: 'InvoiceId', + columnComment: '', + dataType: 'int', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'InvoiceLine', + notNull: true, + autoIncrement: false, + columnName: 'TrackId', + columnComment: '', + dataType: 'int', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'InvoiceLine', + notNull: true, + autoIncrement: false, + columnName: 'UnitPrice', + columnComment: '', + dataType: 'decimal(10,2)', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'InvoiceLine', + notNull: true, + autoIncrement: false, + columnName: 'Quantity', + columnComment: '', + dataType: 'int', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + ], + primaryKey: { + constraintName: 'PRIMARY', + pureName: 'InvoiceLine', + constraintType: 'primaryKey', + columns: [ + { + columnName: 'InvoiceLineId', + }, + ], + }, + foreignKeys: [ + { + constraintName: 'FK_InvoiceLineInvoiceId', + constraintType: 'foreignKey', + pureName: 'InvoiceLine', + refTableName: 'Invoice', + updateAction: 'NO ACTION', + deleteAction: 'NO ACTION', + columns: [ + { + columnName: 'InvoiceId', + refColumnName: 'InvoiceId', + }, + ], + }, + { + constraintName: 'FK_InvoiceLineTrackId', + constraintType: 'foreignKey', + pureName: 'InvoiceLine', + refTableName: 'Track', + updateAction: 'NO ACTION', + deleteAction: 'NO ACTION', + columns: [ + { + columnName: 'TrackId', + refColumnName: 'TrackId', + }, + ], + }, + ], + indexes: [ + { + constraintName: 'IFK_InvoiceLineTrackId', + indexType: 'BTREE', + isUnique: false, + columns: [ + { + columnName: 'TrackId', + }, + ], + pureName: 'InvoiceLine', + constraintType: 'index', + }, + { + constraintName: 'IFK_InvoiceLineInvoiceId', + indexType: 'BTREE', + isUnique: false, + columns: [ + { + columnName: 'InvoiceId', + }, + ], + pureName: 'InvoiceLine', + constraintType: 'index', + }, + ], + uniques: [], + engine: 'mariadb@dbgate-plugin-mysql', + dependencies: [], + objectTypeField: 'tables', + checks: [], + }, + { + pureName: 'Album', + tableRowCount: '347', + modifyDate: '2022-04-09 09:26:46', + objectId: 'Album', + contentHash: '2022-04-09 09:26:46', + columns: [ + { + pureName: 'Album', + notNull: true, + autoIncrement: true, + columnName: 'AlbumId', + columnComment: '', + dataType: 'int', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Album', + notNull: true, + autoIncrement: false, + columnName: 'Title', + columnComment: '', + dataType: 'varchar(160)', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Album', + notNull: true, + autoIncrement: false, + columnName: 'ArtistId', + columnComment: '', + dataType: 'int', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + ], + primaryKey: { + constraintName: 'PRIMARY', + pureName: 'Album', + constraintType: 'primaryKey', + columns: [ + { + columnName: 'AlbumId', + }, + ], + }, + foreignKeys: [ + { + constraintName: 'FK_AlbumArtistId', + constraintType: 'foreignKey', + pureName: 'Album', + refTableName: 'Artist', + updateAction: 'NO ACTION', + deleteAction: 'NO ACTION', + columns: [ + { + columnName: 'ArtistId', + refColumnName: 'ArtistId', + }, + ], + }, + ], + indexes: [ + { + constraintName: 'IFK_AlbumArtistId', + indexType: 'BTREE', + isUnique: false, + columns: [ + { + columnName: 'ArtistId', + }, + ], + pureName: 'Album', + constraintType: 'index', + }, + ], + uniques: [], + engine: 'mariadb@dbgate-plugin-mysql', + dependencies: [ + { + constraintName: 'FK_TrackAlbumId', + constraintType: 'foreignKey', + pureName: 'Track', + refTableName: 'Album', + updateAction: 'NO ACTION', + deleteAction: 'NO ACTION', + columns: [ + { + columnName: 'AlbumId', + refColumnName: 'AlbumId', + }, + ], + }, + ], + objectTypeField: 'tables', + checks: [], + }, + { + pureName: 'Invoice', + tableRowCount: '412', + modifyDate: '2022-04-09 09:26:46', + objectId: 'Invoice', + contentHash: '2022-04-09 09:26:46', + columns: [ + { + pureName: 'Invoice', + notNull: true, + autoIncrement: true, + columnName: 'InvoiceId', + columnComment: '', + dataType: 'int', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Invoice', + notNull: true, + autoIncrement: false, + columnName: 'CustomerId', + columnComment: '', + dataType: 'int', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Invoice', + notNull: true, + autoIncrement: false, + columnName: 'InvoiceDate', + columnComment: '', + dataType: 'datetime', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Invoice', + notNull: false, + autoIncrement: false, + columnName: 'BillingAddress', + columnComment: '', + dataType: 'varchar(70)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Invoice', + notNull: false, + autoIncrement: false, + columnName: 'BillingCity', + columnComment: '', + dataType: 'varchar(40)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Invoice', + notNull: false, + autoIncrement: false, + columnName: 'BillingState', + columnComment: '', + dataType: 'varchar(40)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Invoice', + notNull: false, + autoIncrement: false, + columnName: 'BillingCountry', + columnComment: '', + dataType: 'varchar(40)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Invoice', + notNull: false, + autoIncrement: false, + columnName: 'BillingPostalCode', + columnComment: '', + dataType: 'varchar(10)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Invoice', + notNull: true, + autoIncrement: false, + columnName: 'Total', + columnComment: '', + dataType: 'decimal(10,2)', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + ], + primaryKey: { + constraintName: 'PRIMARY', + pureName: 'Invoice', + constraintType: 'primaryKey', + columns: [ + { + columnName: 'InvoiceId', + }, + ], + }, + foreignKeys: [ + { + constraintName: 'FK_InvoiceCustomerId', + constraintType: 'foreignKey', + pureName: 'Invoice', + refTableName: 'Customer', + updateAction: 'NO ACTION', + deleteAction: 'NO ACTION', + columns: [ + { + columnName: 'CustomerId', + refColumnName: 'CustomerId', + }, + ], + }, + ], + indexes: [ + { + constraintName: 'IFK_InvoiceCustomerId', + indexType: 'BTREE', + isUnique: false, + columns: [ + { + columnName: 'CustomerId', + }, + ], + pureName: 'Invoice', + constraintType: 'index', + }, + ], + uniques: [], + engine: 'mariadb@dbgate-plugin-mysql', + dependencies: [ + { + constraintName: 'FK_InvoiceLineInvoiceId', + constraintType: 'foreignKey', + pureName: 'InvoiceLine', + refTableName: 'Invoice', + updateAction: 'NO ACTION', + deleteAction: 'NO ACTION', + columns: [ + { + columnName: 'InvoiceId', + refColumnName: 'InvoiceId', + }, + ], + }, + ], + objectTypeField: 'tables', + checks: [], + }, + { + pureName: 'Genre_copy', + tableRowCount: '412', + modifyDate: '2022-04-28 12:59:29', + objectId: 'Genre_copy', + contentHash: '2022-04-28 12:59:29', + columns: [ + { + pureName: 'Genre_copy', + notNull: false, + autoIncrement: false, + columnName: 'GenreId', + columnComment: '', + dataType: 'longtext', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Genre_copy', + notNull: false, + autoIncrement: false, + columnName: 'Name', + columnComment: '', + dataType: 'longtext', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + ], + foreignKeys: [], + indexes: [], + uniques: [], + engine: 'mariadb@dbgate-plugin-mysql', + dependencies: [], + objectTypeField: 'tables', + checks: [], + }, + { + pureName: 'MediaType', + tableRowCount: '5', + modifyDate: '2022-04-09 09:26:46', + objectId: 'MediaType', + contentHash: '2022-04-09 09:26:46', + columns: [ + { + pureName: 'MediaType', + notNull: true, + autoIncrement: true, + columnName: 'MediaTypeId', + columnComment: '', + dataType: 'int', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'MediaType', + notNull: false, + autoIncrement: false, + columnName: 'Name', + columnComment: '', + dataType: 'varchar(120)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + ], + primaryKey: { + constraintName: 'PRIMARY', + pureName: 'MediaType', + constraintType: 'primaryKey', + columns: [ + { + columnName: 'MediaTypeId', + }, + ], + }, + foreignKeys: [], + indexes: [], + uniques: [], + engine: 'mariadb@dbgate-plugin-mysql', + dependencies: [ + { + constraintName: 'FK_TrackMediaTypeId', + constraintType: 'foreignKey', + pureName: 'Track', + refTableName: 'MediaType', + updateAction: 'NO ACTION', + deleteAction: 'NO ACTION', + columns: [ + { + columnName: 'MediaTypeId', + refColumnName: 'MediaTypeId', + }, + ], + }, + ], + objectTypeField: 'tables', + checks: [], + }, + { + pureName: 'Genre', + tableRowCount: '25', + modifyDate: '2022-04-09 09:26:46', + objectId: 'Genre', + contentHash: '2022-04-09 09:26:46', + columns: [ + { + pureName: 'Genre', + notNull: true, + autoIncrement: true, + columnName: 'GenreId', + columnComment: '', + dataType: 'int', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Genre', + notNull: false, + autoIncrement: false, + columnName: 'Name', + columnComment: '', + dataType: 'varchar(120)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + ], + primaryKey: { + constraintName: 'PRIMARY', + pureName: 'Genre', + constraintType: 'primaryKey', + columns: [ + { + columnName: 'GenreId', + }, + ], + }, + foreignKeys: [], + indexes: [], + uniques: [], + engine: 'mariadb@dbgate-plugin-mysql', + dependencies: [ + { + constraintName: 'FK_TrackGenreId', + constraintType: 'foreignKey', + pureName: 'Track', + refTableName: 'Genre', + updateAction: 'NO ACTION', + deleteAction: 'NO ACTION', + columns: [ + { + columnName: 'GenreId', + refColumnName: 'GenreId', + }, + ], + }, + ], + objectTypeField: 'tables', + checks: [], + }, + { + pureName: 'Playlist', + tableRowCount: '18', + modifyDate: '2022-04-09 09:26:46', + objectId: 'Playlist', + contentHash: '2022-04-09 09:26:46', + columns: [ + { + pureName: 'Playlist', + notNull: true, + autoIncrement: true, + columnName: 'PlaylistId', + columnComment: '', + dataType: 'int', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Playlist', + notNull: false, + autoIncrement: false, + columnName: 'Name', + columnComment: '', + dataType: 'varchar(120)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + ], + primaryKey: { + constraintName: 'PRIMARY', + pureName: 'Playlist', + constraintType: 'primaryKey', + columns: [ + { + columnName: 'PlaylistId', + }, + ], + }, + foreignKeys: [], + indexes: [], + uniques: [], + engine: 'mariadb@dbgate-plugin-mysql', + dependencies: [ + { + constraintName: 'FK_PlaylistTrackPlaylistId', + constraintType: 'foreignKey', + pureName: 'PlaylistTrack', + refTableName: 'Playlist', + updateAction: 'NO ACTION', + deleteAction: 'NO ACTION', + columns: [ + { + columnName: 'PlaylistId', + refColumnName: 'PlaylistId', + }, + ], + }, + ], + objectTypeField: 'tables', + checks: [], + }, + { + pureName: 'Artist', + tableRowCount: '275', + modifyDate: '2022-04-09 09:26:46', + objectId: 'Artist', + contentHash: '2022-04-09 09:26:46', + columns: [ + { + pureName: 'Artist', + notNull: true, + autoIncrement: true, + columnName: 'ArtistId', + columnComment: '', + dataType: 'int', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Artist', + notNull: false, + autoIncrement: false, + columnName: 'Name', + columnComment: '', + dataType: 'varchar(120)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + ], + primaryKey: { + constraintName: 'PRIMARY', + pureName: 'Artist', + constraintType: 'primaryKey', + columns: [ + { + columnName: 'ArtistId', + }, + ], + }, + foreignKeys: [], + indexes: [], + uniques: [], + engine: 'mariadb@dbgate-plugin-mysql', + dependencies: [ + { + constraintName: 'FK_AlbumArtistId', + constraintType: 'foreignKey', + pureName: 'Album', + refTableName: 'Artist', + updateAction: 'NO ACTION', + deleteAction: 'NO ACTION', + columns: [ + { + columnName: 'ArtistId', + refColumnName: 'ArtistId', + }, + ], + }, + ], + objectTypeField: 'tables', + checks: [], + }, + { + pureName: 'Employee', + tableRowCount: '8', + modifyDate: '2022-04-09 09:26:46', + objectId: 'Employee', + contentHash: '2022-04-09 09:26:46', + columns: [ + { + pureName: 'Employee', + notNull: true, + autoIncrement: true, + columnName: 'EmployeeId', + columnComment: '', + dataType: 'int', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Employee', + notNull: true, + autoIncrement: false, + columnName: 'LastName', + columnComment: '', + dataType: 'varchar(20)', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Employee', + notNull: true, + autoIncrement: false, + columnName: 'FirstName', + columnComment: '', + dataType: 'varchar(20)', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Employee', + notNull: false, + autoIncrement: false, + columnName: 'Title', + columnComment: '', + dataType: 'varchar(30)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Employee', + notNull: false, + autoIncrement: false, + columnName: 'ReportsTo', + columnComment: '', + dataType: 'int', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Employee', + notNull: false, + autoIncrement: false, + columnName: 'BirthDate', + columnComment: '', + dataType: 'datetime', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Employee', + notNull: false, + autoIncrement: false, + columnName: 'HireDate', + columnComment: '', + dataType: 'datetime', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Employee', + notNull: false, + autoIncrement: false, + columnName: 'Address', + columnComment: '', + dataType: 'varchar(70)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Employee', + notNull: false, + autoIncrement: false, + columnName: 'City', + columnComment: '', + dataType: 'varchar(40)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Employee', + notNull: false, + autoIncrement: false, + columnName: 'State', + columnComment: '', + dataType: 'varchar(40)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Employee', + notNull: false, + autoIncrement: false, + columnName: 'Country', + columnComment: '', + dataType: 'varchar(40)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Employee', + notNull: false, + autoIncrement: false, + columnName: 'PostalCode', + columnComment: '', + dataType: 'varchar(10)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Employee', + notNull: false, + autoIncrement: false, + columnName: 'Phone', + columnComment: '', + dataType: 'varchar(24)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Employee', + notNull: false, + autoIncrement: false, + columnName: 'Fax', + columnComment: '', + dataType: 'varchar(24)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'Employee', + notNull: false, + autoIncrement: false, + columnName: 'Email', + columnComment: '', + dataType: 'varchar(60)', + defaultValue: 'NULL', + isUnsigned: false, + isZerofill: false, + }, + ], + primaryKey: { + constraintName: 'PRIMARY', + pureName: 'Employee', + constraintType: 'primaryKey', + columns: [ + { + columnName: 'EmployeeId', + }, + ], + }, + foreignKeys: [ + { + constraintName: 'FK_EmployeeReportsTo', + constraintType: 'foreignKey', + pureName: 'Employee', + refTableName: 'Employee', + updateAction: 'NO ACTION', + deleteAction: 'NO ACTION', + columns: [ + { + columnName: 'ReportsTo', + refColumnName: 'EmployeeId', + }, + ], + }, + ], + indexes: [ + { + constraintName: 'IFK_EmployeeReportsTo', + indexType: 'BTREE', + isUnique: false, + columns: [ + { + columnName: 'ReportsTo', + }, + ], + pureName: 'Employee', + constraintType: 'index', + }, + ], + uniques: [], + engine: 'mariadb@dbgate-plugin-mysql', + dependencies: [ + { + constraintName: 'FK_CustomerSupportRepId', + constraintType: 'foreignKey', + pureName: 'Customer', + refTableName: 'Employee', + updateAction: 'NO ACTION', + deleteAction: 'NO ACTION', + columns: [ + { + columnName: 'SupportRepId', + refColumnName: 'EmployeeId', + }, + ], + }, + { + constraintName: 'FK_EmployeeReportsTo', + constraintType: 'foreignKey', + pureName: 'Employee', + refTableName: 'Employee', + updateAction: 'NO ACTION', + deleteAction: 'NO ACTION', + columns: [ + { + columnName: 'ReportsTo', + refColumnName: 'EmployeeId', + }, + ], + }, + ], + objectTypeField: 'tables', + checks: [], + }, + { + pureName: 'PlaylistTrack', + tableRowCount: '8715', + modifyDate: '2022-04-09 09:26:46', + objectId: 'PlaylistTrack', + contentHash: '2022-04-09 09:26:46', + columns: [ + { + pureName: 'PlaylistTrack', + notNull: true, + autoIncrement: false, + columnName: 'PlaylistId', + columnComment: '', + dataType: 'int', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + { + pureName: 'PlaylistTrack', + notNull: true, + autoIncrement: false, + columnName: 'TrackId', + columnComment: '', + dataType: 'int', + defaultValue: null, + isUnsigned: false, + isZerofill: false, + }, + ], + primaryKey: { + constraintName: 'PRIMARY', + pureName: 'PlaylistTrack', + constraintType: 'primaryKey', + columns: [ + { + columnName: 'PlaylistId', + }, + { + columnName: 'TrackId', + }, + ], + }, + foreignKeys: [ + { + constraintName: 'FK_PlaylistTrackPlaylistId', + constraintType: 'foreignKey', + pureName: 'PlaylistTrack', + refTableName: 'Playlist', + updateAction: 'NO ACTION', + deleteAction: 'NO ACTION', + columns: [ + { + columnName: 'PlaylistId', + refColumnName: 'PlaylistId', + }, + ], + }, + { + constraintName: 'FK_PlaylistTrackTrackId', + constraintType: 'foreignKey', + pureName: 'PlaylistTrack', + refTableName: 'Track', + updateAction: 'NO ACTION', + deleteAction: 'NO ACTION', + columns: [ + { + columnName: 'TrackId', + refColumnName: 'TrackId', + }, + ], + }, + ], + indexes: [ + { + constraintName: 'IFK_PlaylistTrackTrackId', + indexType: 'BTREE', + isUnique: false, + columns: [ + { + columnName: 'TrackId', + }, + ], + pureName: 'PlaylistTrack', + constraintType: 'index', + }, + ], + uniques: [], + engine: 'mariadb@dbgate-plugin-mysql', + dependencies: [], + objectTypeField: 'tables', + checks: [], + }, + ], + views: [], + procedures: [], + functions: [], + engine: 'mariadb@dbgate-plugin-mysql', + collections: [], + matviews: [], + triggers: [], +}; + +// const ARTIST_TABLE: TableInfo = { +// pureName: 'Artist', +// columns: [ +// { +// pureName: 'Artist', +// notNull: true, +// autoIncrement: true, +// columnName: 'ArtistId', +// columnComment: '', +// dataType: 'int', +// }, +// { +// pureName: 'Artist', +// notNull: false, +// columnName: 'Name', +// dataType: 'varchar(120)', +// }, +// ], +// primaryKey: { +// constraintName: 'PRIMARY', +// pureName: 'Artist', +// constraintType: 'primaryKey', +// columns: [ +// { +// columnName: 'ArtistId', +// }, +// ], +// }, +// foreignKeys: [], +// indexes: [], +// uniques: [], +// dependencies: [ +// { +// constraintName: 'FK_AlbumArtistId', +// constraintType: 'foreignKey', +// pureName: 'Album', +// refTableName: 'Artist', +// columns: [ +// { +// columnName: 'ArtistId', +// refColumnName: 'ArtistId', +// }, +// ], +// }, +// ], +// objectTypeField: 'tables', +// checks: [], +// }; + +// const ALBUM_TABLE: TableInfo = { +// pureName: 'Album', +// columns: [ +// { +// pureName: 'Album', +// notNull: true, +// autoIncrement: true, +// columnName: 'AlbumId', +// dataType: 'int', +// }, +// { +// pureName: 'Album', +// notNull: true, +// columnName: 'Title', +// dataType: 'varchar(160)', +// }, +// { +// pureName: 'Album', +// notNull: true, +// autoIncrement: false, +// columnName: 'ArtistId', +// dataType: 'int', +// }, +// ], +// primaryKey: { +// constraintName: 'PRIMARY', +// pureName: 'Album', +// constraintType: 'primaryKey', +// columns: [ +// { +// columnName: 'AlbumId', +// }, +// ], +// }, +// foreignKeys: [ +// { +// constraintName: 'FK_AlbumArtistId', +// constraintType: 'foreignKey', +// pureName: 'Album', +// refTableName: 'Artist', +// columns: [ +// { +// columnName: 'ArtistId', +// refColumnName: 'ArtistId', +// }, +// ], +// }, +// ], +// uniques: [], +// dependencies: [ +// { +// constraintName: 'FK_TrackAlbumId', +// constraintType: 'foreignKey', +// pureName: 'Track', +// refTableName: 'Album', +// columns: [ +// { +// columnName: 'AlbumId', +// refColumnName: 'AlbumId', +// }, +// ], +// }, +// ], +// objectTypeField: 'tables', +// checks: [], +// }; + +// const TRACK_TABLE: TableInfo = { +// pureName: 'Track', +// columns: [ +// { +// pureName: 'Track', +// notNull: true, +// autoIncrement: true, +// columnName: 'TrackId', +// dataType: 'int', +// }, +// { +// pureName: 'Track', +// notNull: true, +// columnName: 'Name', +// dataType: 'varchar(200)', +// }, +// { +// pureName: 'Track', +// columnName: 'AlbumId', +// dataType: 'int', +// }, +// { +// pureName: 'Track', +// notNull: true, +// columnName: 'MediaTypeId', +// dataType: 'int', +// }, +// { +// pureName: 'Track', +// columnName: 'GenreId', +// dataType: 'int', +// }, +// { +// pureName: 'Track', +// notNull: false, +// autoIncrement: false, +// columnName: 'Composer', +// columnComment: '', +// dataType: 'varchar(220)', +// defaultValue: 'NULL', +// isUnsigned: false, +// isZerofill: false, +// }, +// { +// pureName: 'Track', +// notNull: true, +// autoIncrement: false, +// columnName: 'Milliseconds', +// columnComment: '', +// dataType: 'int', +// defaultValue: null, +// isUnsigned: false, +// isZerofill: false, +// }, +// { +// pureName: 'Track', +// notNull: false, +// autoIncrement: false, +// columnName: 'Bytes', +// columnComment: '', +// dataType: 'int', +// defaultValue: 'NULL', +// isUnsigned: false, +// isZerofill: false, +// }, +// { +// pureName: 'Track', +// notNull: true, +// autoIncrement: false, +// columnName: 'UnitPrice', +// columnComment: '', +// dataType: 'decimal(10,2)', +// defaultValue: null, +// isUnsigned: false, +// isZerofill: false, +// }, +// ], +// primaryKey: { +// constraintName: 'PRIMARY', +// pureName: 'Track', +// constraintType: 'primaryKey', +// columns: [ +// { +// columnName: 'TrackId', +// }, +// ], +// }, +// foreignKeys: [ +// { +// constraintName: 'FK_TrackMediaTypeId', +// constraintType: 'foreignKey', +// pureName: 'Track', +// refTableName: 'MediaType', +// updateAction: 'NO ACTION', +// deleteAction: 'NO ACTION', +// columns: [ +// { +// columnName: 'MediaTypeId', +// refColumnName: 'MediaTypeId', +// }, +// ], +// }, +// { +// constraintName: 'FK_TrackAlbumId', +// constraintType: 'foreignKey', +// pureName: 'Track', +// refTableName: 'Album', +// updateAction: 'NO ACTION', +// deleteAction: 'NO ACTION', +// columns: [ +// { +// columnName: 'AlbumId', +// refColumnName: 'AlbumId', +// }, +// ], +// }, +// { +// constraintName: 'FK_TrackGenreId', +// constraintType: 'foreignKey', +// pureName: 'Track', +// refTableName: 'Genre', +// updateAction: 'NO ACTION', +// deleteAction: 'NO ACTION', +// columns: [ +// { +// columnName: 'GenreId', +// refColumnName: 'GenreId', +// }, +// ], +// }, +// ], +// uniques: [], +// dependencies: [ +// { +// constraintName: 'FK_InvoiceLineTrackId', +// constraintType: 'foreignKey', +// pureName: 'InvoiceLine', +// refTableName: 'Track', +// updateAction: 'NO ACTION', +// deleteAction: 'NO ACTION', +// columns: [ +// { +// columnName: 'TrackId', +// refColumnName: 'TrackId', +// }, +// ], +// }, +// { +// constraintName: 'FK_PlaylistTrackTrackId', +// constraintType: 'foreignKey', +// pureName: 'PlaylistTrack', +// refTableName: 'Track', +// updateAction: 'NO ACTION', +// deleteAction: 'NO ACTION', +// columns: [ +// { +// columnName: 'TrackId', +// refColumnName: 'TrackId', +// }, +// ], +// }, +// ], +// objectTypeField: 'tables', +// checks: [], +// }; diff --git a/packages/types/dbinfo.d.ts b/packages/types/dbinfo.d.ts index b12bd3471..0856d2027 100644 --- a/packages/types/dbinfo.d.ts +++ b/packages/types/dbinfo.d.ts @@ -1,6 +1,8 @@ export interface NamedObjectInfo { pureName: string; schemaName?: string; + contentHash?: string; + engine?: string; } export interface ColumnReference { @@ -31,7 +33,8 @@ export interface ForeignKeyInfo extends ColumnsConstraintInfo { export interface IndexInfo extends ColumnsConstraintInfo { isUnique: boolean; - indexType: 'normal' | 'clustered' | 'xml' | 'spatial' | 'fulltext'; + // indexType: 'normal' | 'clustered' | 'xml' | 'spatial' | 'fulltext'; + indexType: string; } export interface UniqueInfo extends ColumnsConstraintInfo {} @@ -43,8 +46,8 @@ export interface CheckInfo extends ConstraintInfo { export interface ColumnInfo extends NamedObjectInfo { pairingId?: string; columnName: string; - notNull: boolean; - autoIncrement: boolean; + notNull?: boolean; + autoIncrement?: boolean; dataType: string; precision?: number; scale?: number; @@ -119,7 +122,7 @@ export interface DatabaseInfoObjects { } export interface DatabaseInfo extends DatabaseInfoObjects { - schemas: SchemaInfo[]; + schemas?: SchemaInfo[]; engine?: string; defaultSchema?: string; } diff --git a/packages/web/src/perspectives/PerspectiveTable.svelte b/packages/web/src/perspectives/PerspectiveTable.svelte index b86fc071f..bbbd4d2cd 100644 --- a/packages/web/src/perspectives/PerspectiveTable.svelte +++ b/packages/web/src/perspectives/PerspectiveTable.svelte @@ -1,3 +1,16 @@ + + @@ -129,7 +157,7 @@ {column.title} {/if} {#if column.showParent(columnLevel)} - {column.getParentName(columnLevel)} + {column.getParentName(columnLevel)} {/if} {/each} @@ -169,10 +197,12 @@ {:else} {#each display.columns as column} - {#if row.rowData[column.columnIndex] === undefined} - - {:else if !row.rowData[column.columnIndex]?.__perspective_skip_cell__} - {row.rowData[column.columnIndex]} + {#if !row.rowCellSkips[column.columnIndex]} + {#if row.rowData[column.columnIndex] === undefined} + + {:else} + {row.rowData[column.columnIndex]} + {/if} {/if} {/each} {/if} diff --git a/packages/web/src/perspectives/PerspectiveView.svelte b/packages/web/src/perspectives/PerspectiveView.svelte index 9e94dc8e9..3efee0500 100644 --- a/packages/web/src/perspectives/PerspectiveView.svelte +++ b/packages/web/src/perspectives/PerspectiveView.svelte @@ -59,16 +59,10 @@ $: dataProvider = new PerspectiveDataProvider(cache, loader); $: loader = new PerspectiveDataLoader(apiCall); $: root = $tableInfo - ? new PerspectiveTableNode( - $tableInfo, - $dbInfo, - config, - setConfig, - dataProvider, - { conid, database }, - null - ) + ? new PerspectiveTableNode($tableInfo, $dbInfo, config, setConfig, dataProvider, { conid, database }, null) : null; + + // $: console.log('CONFIG', config);