From 1745f83a50edb9482777065e73ae8d7d160a8cca Mon Sep 17 00:00:00 2001 From: Nick Zelei <2420177+nickzelei@users.noreply.github.com> Date: Thu, 31 Oct 2024 15:37:30 -0700 Subject: [PATCH] Consolidates Database Schema Row Structs (#2891) --- .mockery.yml | 2 +- backend/pkg/sqlmanager/mock_SqlDatabase.go | 14 +- backend/pkg/sqlmanager/mssql/mssql-manager.go | 6 +- .../mssql/mssql-manager_integration_test.go | 2 +- backend/pkg/sqlmanager/mysql/mysql-manager.go | 6 +- .../sqlmanager/postgres/postgres-manager.go | 6 +- .../postgres-manager_integration_test.go | 4 +- backend/pkg/sqlmanager/shared/types.go | 20 +- backend/pkg/sqlmanager/shared/utils.go | 23 +- backend/pkg/sqlmanager/sql-manager.go | 4 +- .../connection-data.go | 2 +- .../connection-data_test.go | 9 +- .../mgmt/v1alpha1/job-service/jobs.go | 2 +- .../mgmt/v1alpha1/job-service/jobs_test.go | 20 +- cli/internal/cmds/neosync/sync/sync.go | 2 +- .../builders/benthos-builder_test.go | 148 +++++------ .../benthos-builder/builders/dynamodb.go | 2 +- .../benthos-builder/builders/mongodb.go | 2 +- .../benthos-builder/builders/processors.go | 28 +-- .../builders/processors_test.go | 10 +- .../benthos-builder/builders/sql-util.go | 8 +- .../benthos/benthos-builder/builders/sql.go | 26 +- .../benthos/benthos-builder/shared/types.go | 2 +- .../query-builder_integration_test.go | 234 +++++++++--------- worker/pkg/query-builder2/querybuilder.go | 4 +- worker/pkg/query-builder2/subset.go | 4 +- worker/pkg/query-builder2/wrapper.go | 2 +- 27 files changed, 288 insertions(+), 304 deletions(-) diff --git a/.mockery.yml b/.mockery.yml index f29199192f..51803baa8a 100644 --- a/.mockery.yml +++ b/.mockery.yml @@ -95,7 +95,7 @@ packages: interfaces: ManagerInterface: ClientInterface: - github.com/nucleuscloud/neosync/worker/internal/connection-tunnel-manager: + github.com/nucleuscloud/neosync/internal/connection-tunnel-manager: interfaces: ConnectionProvider: github.com/nucleuscloud/neosync/worker/pkg/benthos/dynamodb: diff --git a/backend/pkg/sqlmanager/mock_SqlDatabase.go b/backend/pkg/sqlmanager/mock_SqlDatabase.go index e5b674c15d..2c76d815c4 100644 --- a/backend/pkg/sqlmanager/mock_SqlDatabase.go +++ b/backend/pkg/sqlmanager/mock_SqlDatabase.go @@ -325,23 +325,23 @@ func (_c *MockSqlDatabase_GetRolePermissionsMap_Call) RunAndReturn(run func(cont } // GetSchemaColumnMap provides a mock function with given fields: ctx -func (_m *MockSqlDatabase) GetSchemaColumnMap(ctx context.Context) (map[string]map[string]*sqlmanager_shared.ColumnInfo, error) { +func (_m *MockSqlDatabase) GetSchemaColumnMap(ctx context.Context) (map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow, error) { ret := _m.Called(ctx) if len(ret) == 0 { panic("no return value specified for GetSchemaColumnMap") } - var r0 map[string]map[string]*sqlmanager_shared.ColumnInfo + var r0 map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (map[string]map[string]*sqlmanager_shared.ColumnInfo, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context) (map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow, error)); ok { return rf(ctx) } - if rf, ok := ret.Get(0).(func(context.Context) map[string]map[string]*sqlmanager_shared.ColumnInfo); ok { + if rf, ok := ret.Get(0).(func(context.Context) map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow); ok { r0 = rf(ctx) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(map[string]map[string]*sqlmanager_shared.ColumnInfo) + r0 = ret.Get(0).(map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow) } } @@ -372,12 +372,12 @@ func (_c *MockSqlDatabase_GetSchemaColumnMap_Call) Run(run func(ctx context.Cont return _c } -func (_c *MockSqlDatabase_GetSchemaColumnMap_Call) Return(_a0 map[string]map[string]*sqlmanager_shared.ColumnInfo, _a1 error) *MockSqlDatabase_GetSchemaColumnMap_Call { +func (_c *MockSqlDatabase_GetSchemaColumnMap_Call) Return(_a0 map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow, _a1 error) *MockSqlDatabase_GetSchemaColumnMap_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MockSqlDatabase_GetSchemaColumnMap_Call) RunAndReturn(run func(context.Context) (map[string]map[string]*sqlmanager_shared.ColumnInfo, error)) *MockSqlDatabase_GetSchemaColumnMap_Call { +func (_c *MockSqlDatabase_GetSchemaColumnMap_Call) RunAndReturn(run func(context.Context) (map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow, error)) *MockSqlDatabase_GetSchemaColumnMap_Call { _c.Call.Return(run) return _c } diff --git a/backend/pkg/sqlmanager/mssql/mssql-manager.go b/backend/pkg/sqlmanager/mssql/mssql-manager.go index e5b5cdf4bd..f8c7ebca03 100644 --- a/backend/pkg/sqlmanager/mssql/mssql-manager.go +++ b/backend/pkg/sqlmanager/mssql/mssql-manager.go @@ -67,7 +67,7 @@ func (m *Manager) GetDatabaseSchema(ctx context.Context) ([]*sqlmanager_shared.D ColumnName: row.ColumnName, DataType: row.DataType, ColumnDefault: row.ColumnDefault, // todo: make sure this is valid for the other funcs - IsNullable: row.IsNullable, + IsNullable: row.IsNullable != "NO", GeneratedType: generatedType, OrdinalPosition: int(row.OrdinalPosition), CharacterMaximumLength: charMaxLength, @@ -80,7 +80,7 @@ func (m *Manager) GetDatabaseSchema(ctx context.Context) ([]*sqlmanager_shared.D return output, nil } -func (m *Manager) GetSchemaColumnMap(ctx context.Context) (map[string]map[string]*sqlmanager_shared.ColumnInfo, error) { +func (m *Manager) GetSchemaColumnMap(ctx context.Context) (map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow, error) { dbSchemas, err := m.GetDatabaseSchema(ctx) if err != nil { return nil, err @@ -309,7 +309,7 @@ func BuildMssqlSetIdentityInsertStatement( return fmt.Sprintf("SET IDENTITY_INSERT %q.%q %s;", schema, table, enabledKeyword) } -func GetMssqlColumnOverrideAndResetProperties(columnInfo *sqlmanager_shared.ColumnInfo) (needsOverride, needsReset bool) { +func GetMssqlColumnOverrideAndResetProperties(columnInfo *sqlmanager_shared.DatabaseSchemaRow) (needsOverride, needsReset bool) { needsOverride = false needsReset = false diff --git a/backend/pkg/sqlmanager/mssql/mssql-manager_integration_test.go b/backend/pkg/sqlmanager/mssql/mssql-manager_integration_test.go index 1df7c59430..e3a3c28f66 100644 --- a/backend/pkg/sqlmanager/mssql/mssql-manager_integration_test.go +++ b/backend/pkg/sqlmanager/mssql/mssql-manager_integration_test.go @@ -21,7 +21,7 @@ func (s *IntegrationTestSuite) Test_GetDatabaseSchema() { ColumnName: "id", DataType: "int", ColumnDefault: "", - IsNullable: "NO", + IsNullable: false, CharacterMaximumLength: -1, NumericPrecision: 10, NumericScale: 0, diff --git a/backend/pkg/sqlmanager/mysql/mysql-manager.go b/backend/pkg/sqlmanager/mysql/mysql-manager.go index feb9d37634..45758509e6 100644 --- a/backend/pkg/sqlmanager/mysql/mysql-manager.go +++ b/backend/pkg/sqlmanager/mysql/mysql-manager.go @@ -85,7 +85,7 @@ func (m *MysqlManager) GetDatabaseSchema(ctx context.Context) ([]*sqlmanager_sha DataType: row.DataType, ColumnDefault: columnDefaultStr, ColumnDefaultType: columnDefaultType, - IsNullable: row.IsNullable, + IsNullable: row.IsNullable != "NO", GeneratedType: generatedType, CharacterMaximumLength: charMaxLength, NumericPrecision: numericPrecision, @@ -98,7 +98,7 @@ func (m *MysqlManager) GetDatabaseSchema(ctx context.Context) ([]*sqlmanager_sha } // returns: {public.users: { id: struct{}{}, created_at: struct{}{}}} -func (m *MysqlManager) GetSchemaColumnMap(ctx context.Context) (map[string]map[string]*sqlmanager_shared.ColumnInfo, error) { +func (m *MysqlManager) GetSchemaColumnMap(ctx context.Context) (map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow, error) { dbSchemas, err := m.GetDatabaseSchema(ctx) if err != nil { return nil, err @@ -841,7 +841,7 @@ func EscapeMysqlDefaultColumn(defaultColumnValue string, defaultColumnType *stri return fmt.Sprintf("(%s)", defaultColumnValue), fmt.Errorf("unsupported default column type: %s, currently supported types are: %v", *defaultColumnType, defaultColumnTypes) } -func GetMysqlColumnOverrideAndResetProperties(columnInfo *sqlmanager_shared.ColumnInfo) (needsOverride, needsReset bool) { +func GetMysqlColumnOverrideAndResetProperties(columnInfo *sqlmanager_shared.DatabaseSchemaRow) (needsOverride, needsReset bool) { needsOverride = false needsReset = false return diff --git a/backend/pkg/sqlmanager/postgres/postgres-manager.go b/backend/pkg/sqlmanager/postgres/postgres-manager.go index 81202573c8..7e4c526331 100644 --- a/backend/pkg/sqlmanager/postgres/postgres-manager.go +++ b/backend/pkg/sqlmanager/postgres/postgres-manager.go @@ -51,7 +51,7 @@ func (p *PostgresManager) GetDatabaseSchema(ctx context.Context) ([]*sqlmanager_ ColumnName: row.ColumnName, DataType: row.DataType, ColumnDefault: row.ColumnDefault, - IsNullable: row.IsNullable, + IsNullable: row.IsNullable != "NO", CharacterMaximumLength: int(row.CharacterMaximumLength), NumericPrecision: int(row.NumericPrecision), NumericScale: int(row.NumericScale), @@ -64,7 +64,7 @@ func (p *PostgresManager) GetDatabaseSchema(ctx context.Context) ([]*sqlmanager_ } // returns: {public.users: { id: struct{}{}, created_at: struct{}{}}} -func (p *PostgresManager) GetSchemaColumnMap(ctx context.Context) (map[string]map[string]*sqlmanager_shared.ColumnInfo, error) { +func (p *PostgresManager) GetSchemaColumnMap(ctx context.Context) (map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow, error) { dbSchemas, err := p.GetDatabaseSchema(ctx) if err != nil { return nil, err @@ -933,7 +933,7 @@ func BuildPgResetSequenceSql(sequenceName string) string { return fmt.Sprintf("ALTER SEQUENCE %s RESTART;", sequenceName) } -func GetPostgresColumnOverrideAndResetProperties(columnInfo *sqlmanager_shared.ColumnInfo) (needsOverride, needsReset bool) { +func GetPostgresColumnOverrideAndResetProperties(columnInfo *sqlmanager_shared.DatabaseSchemaRow) (needsOverride, needsReset bool) { needsOverride = false needsReset = false diff --git a/backend/pkg/sqlmanager/postgres/postgres-manager_integration_test.go b/backend/pkg/sqlmanager/postgres/postgres-manager_integration_test.go index 32c2756657..c0c88749d7 100644 --- a/backend/pkg/sqlmanager/postgres/postgres-manager_integration_test.go +++ b/backend/pkg/sqlmanager/postgres/postgres-manager_integration_test.go @@ -22,7 +22,7 @@ func (s *IntegrationTestSuite) Test_GetDatabaseSchema() { ColumnName: "id", DataType: "text", ColumnDefault: "", - IsNullable: "NO", + IsNullable: false, CharacterMaximumLength: -1, NumericPrecision: -1, NumericScale: -1, @@ -45,7 +45,7 @@ func (s *IntegrationTestSuite) Test_GetDatabaseSchema_With_Identity() { ColumnName: "id", DataType: "integer", ColumnDefault: "", - IsNullable: "NO", + IsNullable: false, CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0, diff --git a/backend/pkg/sqlmanager/shared/types.go b/backend/pkg/sqlmanager/shared/types.go index 26e5d1c315..4f68688f21 100644 --- a/backend/pkg/sqlmanager/shared/types.go +++ b/backend/pkg/sqlmanager/shared/types.go @@ -15,7 +15,7 @@ type DatabaseSchemaRow struct { DataType string ColumnDefault string ColumnDefaultType *string - IsNullable string + IsNullable bool CharacterMaximumLength int NumericPrecision int NumericScale int @@ -24,6 +24,13 @@ type DatabaseSchemaRow struct { IdentityGeneration *string } +func (d *DatabaseSchemaRow) NullableString() string { + if d.IsNullable { + return "YES" + } + return "NO" +} + type ForeignKeyConstraintsRow struct { ConstraintName string SchemaName string @@ -117,17 +124,6 @@ type TableConstraints struct { UniqueConstraints map[string][][]string } -type ColumnInfo struct { - OrdinalPosition int // Specifies the sequence or order in which each column is defined within the table. Starts at 1 for the first column. - ColumnDefault string // Specifies the default value for a column, if any is set. - IsNullable bool // Specifies if the column is nullable or not. - DataType string // Specifies the data type of the column, i.e., bool, varchar, int, etc. - CharacterMaximumLength *int // Specifies the maximum allowable length of the column for character-based data types. For datatypes such as integers, boolean, dates etc. this is NULL. - NumericPrecision *int // Specifies the precision for numeric data types. It represents the TOTAL count of significant digits in the whole number, that is, the number of digits to BOTH sides of the decimal point. Null for non-numeric data types. - NumericScale *int // Specifies the scale of the column for numeric data types, specifically non-integers. It represents the number of digits to the RIGHT of the decimal point. Null for non-numeric data types and integers. - IdentityGeneration *string // Specifies the identity generation strategy for the column, if applicable. -} - type DataType struct { Schema string Name string diff --git a/backend/pkg/sqlmanager/shared/utils.go b/backend/pkg/sqlmanager/shared/utils.go index 727eaf7203..ed43679f85 100644 --- a/backend/pkg/sqlmanager/shared/utils.go +++ b/backend/pkg/sqlmanager/shared/utils.go @@ -7,34 +7,21 @@ import ( func GetUniqueSchemaColMappings( schemas []*DatabaseSchemaRow, -) map[string]map[string]*ColumnInfo { - groupedSchemas := map[string]map[string]*ColumnInfo{} // ex: {public.users: { id: struct{}{}, created_at: struct{}{}}} +) map[string]map[string]*DatabaseSchemaRow { + groupedSchemas := map[string]map[string]*DatabaseSchemaRow{} // ex: {public.users: { id: struct{}{}, created_at: struct{}{}}} for _, record := range schemas { key := BuildTable(record.TableSchema, record.TableName) if _, ok := groupedSchemas[key]; ok { - groupedSchemas[key][record.ColumnName] = toColumnInfo(record) + groupedSchemas[key][record.ColumnName] = record } else { - groupedSchemas[key] = map[string]*ColumnInfo{ - record.ColumnName: toColumnInfo(record), + groupedSchemas[key] = map[string]*DatabaseSchemaRow{ + record.ColumnName: record, } } } return groupedSchemas } -func toColumnInfo(row *DatabaseSchemaRow) *ColumnInfo { - return &ColumnInfo{ - OrdinalPosition: row.OrdinalPosition, - ColumnDefault: row.ColumnDefault, - IsNullable: ConvertNullableTextToBool(row.IsNullable), - DataType: row.DataType, - CharacterMaximumLength: Ptr(row.CharacterMaximumLength), - NumericPrecision: Ptr(row.NumericPrecision), - NumericScale: Ptr(row.NumericScale), - IdentityGeneration: row.IdentityGeneration, - } -} - func ConvertNullableTextToBool(isNullableStr string) bool { return isNullableStr != "NO" } diff --git a/backend/pkg/sqlmanager/sql-manager.go b/backend/pkg/sqlmanager/sql-manager.go index 157a68c5cd..8bba31239f 100644 --- a/backend/pkg/sqlmanager/sql-manager.go +++ b/backend/pkg/sqlmanager/sql-manager.go @@ -25,7 +25,7 @@ import ( type SqlDatabase interface { GetDatabaseSchema(ctx context.Context) ([]*sqlmanager_shared.DatabaseSchemaRow, error) - GetSchemaColumnMap(ctx context.Context) (map[string]map[string]*sqlmanager_shared.ColumnInfo, error) // ex: {public.users: { id: struct{}{}, created_at: struct{}{}}} + GetSchemaColumnMap(ctx context.Context) (map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow, error) // ex: {public.users: { id: struct{}{}, created_at: struct{}{}}} GetTableConstraintsBySchema(ctx context.Context, schemas []string) (*sqlmanager_shared.TableConstraints, error) GetCreateTableStatement(ctx context.Context, schema, table string) (string, error) GetTableInitStatements(ctx context.Context, tables []*sqlmanager_shared.SchemaTable) ([]*sqlmanager_shared.TableInitStatement, error) @@ -362,7 +362,7 @@ func (s *SqlManager) NewSqlDbFromUrl( }, nil } -func GetColumnOverrideAndResetProperties(driver string, cInfo *sqlmanager_shared.ColumnInfo) (needsOverride, needsReset bool, err error) { +func GetColumnOverrideAndResetProperties(driver string, cInfo *sqlmanager_shared.DatabaseSchemaRow) (needsOverride, needsReset bool, err error) { switch driver { case sqlmanager_shared.PostgresDriver, "postgres": needsOverride, needsReset := sqlmanager_postgres.GetPostgresColumnOverrideAndResetProperties(cInfo) diff --git a/backend/services/mgmt/v1alpha1/connection-data-service/connection-data.go b/backend/services/mgmt/v1alpha1/connection-data-service/connection-data.go index 94222c70c3..00dc6b5d25 100644 --- a/backend/services/mgmt/v1alpha1/connection-data-service/connection-data.go +++ b/backend/services/mgmt/v1alpha1/connection-data-service/connection-data.go @@ -513,7 +513,7 @@ func (s *Service) GetConnectionSchema( Table: col.TableName, Column: col.ColumnName, DataType: col.DataType, - IsNullable: col.IsNullable, + IsNullable: col.NullableString(), ColumnDefault: defaultColumn, GeneratedType: col.GeneratedType, IdentityGeneration: col.IdentityGeneration, diff --git a/backend/services/mgmt/v1alpha1/connection-data-service/connection-data_test.go b/backend/services/mgmt/v1alpha1/connection-data-service/connection-data_test.go index b30a20364f..ac0a452047 100644 --- a/backend/services/mgmt/v1alpha1/connection-data-service/connection-data_test.go +++ b/backend/services/mgmt/v1alpha1/connection-data-service/connection-data_test.go @@ -151,10 +151,11 @@ func Test_GetConnectionSchema_Postgres(t *testing.T) { expected := []*mgmtv1alpha1.DatabaseColumn{} for _, col := range mockColumns { expected = append(expected, &mgmtv1alpha1.DatabaseColumn{ - Schema: col.TableSchema, - Table: col.TableName, - Column: col.ColumnName, - DataType: col.DataType, + Schema: col.TableSchema, + Table: col.TableName, + Column: col.ColumnName, + DataType: col.DataType, + IsNullable: "NO", }) } diff --git a/backend/services/mgmt/v1alpha1/job-service/jobs.go b/backend/services/mgmt/v1alpha1/job-service/jobs.go index 5f4da029fe..5317fd2a78 100644 --- a/backend/services/mgmt/v1alpha1/job-service/jobs.go +++ b/backend/services/mgmt/v1alpha1/job-service/jobs.go @@ -1819,7 +1819,7 @@ func validateVirtualForeignKeys( virtualForeignKeys []*mgmtv1alpha1.VirtualForeignConstraint, jobColMappings map[string]map[string]*mgmtv1alpha1.JobMapping, tc *sqlmanager_shared.TableConstraints, - colMap map[string]map[string]*sqlmanager_shared.ColumnInfo, + colMap map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow, ) *validateVirtualForeignKeysResponse { dbErrors := []string{} colErrorsMap := map[string]map[string][]string{} diff --git a/backend/services/mgmt/v1alpha1/job-service/jobs_test.go b/backend/services/mgmt/v1alpha1/job-service/jobs_test.go index c2ee2b76e0..73d680206a 100644 --- a/backend/services/mgmt/v1alpha1/job-service/jobs_test.go +++ b/backend/services/mgmt/v1alpha1/job-service/jobs_test.go @@ -1788,11 +1788,11 @@ func Test_ValidateJobMappings_NoValidationErrors(t *testing.T) { m.SqlManagerMock.On("NewSqlDb", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(&sql_manager.SqlConnection{Db: m.SqlDbMock, Driver: sqlmanager_shared.PostgresDriver}, nil) m.SqlDbMock.On("Close").Return(nil) - m.SqlDbMock.On("GetSchemaColumnMap", mock.Anything).Return(map[string]map[string]*sqlmanager_shared.ColumnInfo{ - "public.users": {"id": &sqlmanager_shared.ColumnInfo{}, "name": &sqlmanager_shared.ColumnInfo{IsNullable: true}}, - "public.orders": {"id": &sqlmanager_shared.ColumnInfo{}, "buyer_id": &sqlmanager_shared.ColumnInfo{IsNullable: true}}, - "circle.table_1": {"id": &sqlmanager_shared.ColumnInfo{}, "table2_id": &sqlmanager_shared.ColumnInfo{IsNullable: true}}, - "circle.table_2": {"id": &sqlmanager_shared.ColumnInfo{}, "table1_id": &sqlmanager_shared.ColumnInfo{}}, + m.SqlDbMock.On("GetSchemaColumnMap", mock.Anything).Return(map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{ + "public.users": {"id": &sqlmanager_shared.DatabaseSchemaRow{}, "name": &sqlmanager_shared.DatabaseSchemaRow{IsNullable: true}}, + "public.orders": {"id": &sqlmanager_shared.DatabaseSchemaRow{}, "buyer_id": &sqlmanager_shared.DatabaseSchemaRow{IsNullable: true}}, + "circle.table_1": {"id": &sqlmanager_shared.DatabaseSchemaRow{}, "table2_id": &sqlmanager_shared.DatabaseSchemaRow{IsNullable: true}}, + "circle.table_2": {"id": &sqlmanager_shared.DatabaseSchemaRow{}, "table1_id": &sqlmanager_shared.DatabaseSchemaRow{}}, }, nil) m.SqlDbMock.On("GetTableConstraintsBySchema", mock.Anything, mock.Anything).Return(&sqlmanager_shared.TableConstraints{ ForeignKeyConstraints: map[string][]*sqlmanager_shared.ForeignConstraint{ @@ -1857,11 +1857,11 @@ func Test_ValidateJobMappings_ValidationErrors(t *testing.T) { m.SqlManagerMock.On("NewSqlDb", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(&sql_manager.SqlConnection{Db: m.SqlDbMock, Driver: sqlmanager_shared.PostgresDriver}, nil) m.SqlDbMock.On("Close").Return(nil) - m.SqlDbMock.On("GetSchemaColumnMap", mock.Anything).Return(map[string]map[string]*sqlmanager_shared.ColumnInfo{ - "public.users": {"id": &sqlmanager_shared.ColumnInfo{}, "name": &sqlmanager_shared.ColumnInfo{}}, - "public.orders": {"id": &sqlmanager_shared.ColumnInfo{}, "buyer_id": &sqlmanager_shared.ColumnInfo{}}, - "circle.table_1": {"id": &sqlmanager_shared.ColumnInfo{}, "table2_id": &sqlmanager_shared.ColumnInfo{}}, - "circle.table_2": {"id": &sqlmanager_shared.ColumnInfo{}, "table1_id": &sqlmanager_shared.ColumnInfo{}}, + m.SqlDbMock.On("GetSchemaColumnMap", mock.Anything).Return(map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{ + "public.users": {"id": &sqlmanager_shared.DatabaseSchemaRow{}, "name": &sqlmanager_shared.DatabaseSchemaRow{}}, + "public.orders": {"id": &sqlmanager_shared.DatabaseSchemaRow{}, "buyer_id": &sqlmanager_shared.DatabaseSchemaRow{}}, + "circle.table_1": {"id": &sqlmanager_shared.DatabaseSchemaRow{}, "table2_id": &sqlmanager_shared.DatabaseSchemaRow{}}, + "circle.table_2": {"id": &sqlmanager_shared.DatabaseSchemaRow{}, "table1_id": &sqlmanager_shared.DatabaseSchemaRow{}}, }, nil) m.SqlDbMock.On("GetTableConstraintsBySchema", mock.Anything, mock.Anything).Return(&sqlmanager_shared.TableConstraints{ ForeignKeyConstraints: map[string][]*sqlmanager_shared.ForeignConstraint{ diff --git a/cli/internal/cmds/neosync/sync/sync.go b/cli/internal/cmds/neosync/sync/sync.go index a1719d9d9c..11661e4c6b 100644 --- a/cli/internal/cmds/neosync/sync/sync.go +++ b/cli/internal/cmds/neosync/sync/sync.go @@ -1131,7 +1131,7 @@ func (c *clisync) getDestinationSchemas() ([]*mgmtv1alpha1.DatabaseColumn, error Table: col.TableName, Column: col.ColumnName, DataType: col.DataType, - IsNullable: col.IsNullable, + IsNullable: col.NullableString(), ColumnDefault: defaultColumn, GeneratedType: col.GeneratedType, IdentityGeneration: col.IdentityGeneration, diff --git a/internal/benthos/benthos-builder/builders/benthos-builder_test.go b/internal/benthos/benthos-builder/builders/benthos-builder_test.go index 988edc3e5c..100814ee13 100644 --- a/internal/benthos/benthos-builder/builders/benthos-builder_test.go +++ b/internal/benthos/benthos-builder/builders/benthos-builder_test.go @@ -61,25 +61,25 @@ func Test_ProcessorConfigEmpty(t *testing.T) { }, }} - groupedSchemas := map[string]map[string]*sqlmanager_shared.ColumnInfo{ + groupedSchemas := map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{ "public.users": { - "id": &sqlmanager_shared.ColumnInfo{ + "id": &sqlmanager_shared.DatabaseSchemaRow{ OrdinalPosition: 1, ColumnDefault: "324", IsNullable: false, DataType: "", - CharacterMaximumLength: nil, - NumericPrecision: nil, - NumericScale: nil, + CharacterMaximumLength: 0, + NumericPrecision: 0, + NumericScale: 0, }, - "name": &sqlmanager_shared.ColumnInfo{ + "name": &sqlmanager_shared.DatabaseSchemaRow{ OrdinalPosition: 1, ColumnDefault: "324", IsNullable: false, DataType: "", - CharacterMaximumLength: nil, - NumericPrecision: nil, - NumericScale: nil, + CharacterMaximumLength: 0, + NumericPrecision: 0, + NumericScale: 0, }, }, } @@ -152,25 +152,25 @@ func Test_ProcessorConfigEmptyJavascript(t *testing.T) { }, }} - groupedSchemas := map[string]map[string]*sqlmanager_shared.ColumnInfo{ + groupedSchemas := map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{ "public.users": { - "id": &sqlmanager_shared.ColumnInfo{ + "id": &sqlmanager_shared.DatabaseSchemaRow{ OrdinalPosition: 1, ColumnDefault: "324", IsNullable: false, DataType: "", - CharacterMaximumLength: nil, - NumericPrecision: nil, - NumericScale: nil, + CharacterMaximumLength: 0, + NumericPrecision: 0, + NumericScale: 0, }, - "name": &sqlmanager_shared.ColumnInfo{ + "name": &sqlmanager_shared.DatabaseSchemaRow{ OrdinalPosition: 1, ColumnDefault: "324", IsNullable: false, DataType: "", - CharacterMaximumLength: nil, - NumericPrecision: nil, - NumericScale: nil, + CharacterMaximumLength: 0, + NumericPrecision: 0, + NumericScale: 0, }, }, } @@ -214,14 +214,14 @@ func Test_ProcessorConfigEmptyJavascript(t *testing.T) { func TestAreMappingsSubsetOfSchemas(t *testing.T) { ok := areMappingsSubsetOfSchemas( - map[string]map[string]*sqlmanager_shared.ColumnInfo{ + map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{ "public.users": { - "id": &sqlmanager_shared.ColumnInfo{}, - "created_by": &sqlmanager_shared.ColumnInfo{}, - "updated_by": &sqlmanager_shared.ColumnInfo{}, + "id": &sqlmanager_shared.DatabaseSchemaRow{}, + "created_by": &sqlmanager_shared.DatabaseSchemaRow{}, + "updated_by": &sqlmanager_shared.DatabaseSchemaRow{}, }, "neosync_api.accounts": { - "id": &sqlmanager_shared.ColumnInfo{}, + "id": &sqlmanager_shared.DatabaseSchemaRow{}, }, }, []*mgmtv1alpha1.JobMapping{ @@ -232,9 +232,9 @@ func TestAreMappingsSubsetOfSchemas(t *testing.T) { require.True(t, ok, "job mappings are a subset of the present database schemas") ok = areMappingsSubsetOfSchemas( - map[string]map[string]*sqlmanager_shared.ColumnInfo{ + map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{ "public.users": { - "id": &sqlmanager_shared.ColumnInfo{}, + "id": &sqlmanager_shared.DatabaseSchemaRow{}, }, }, []*mgmtv1alpha1.JobMapping{ @@ -244,9 +244,9 @@ func TestAreMappingsSubsetOfSchemas(t *testing.T) { require.False(t, ok, "job mappings contain mapping that is not in the source schema") ok = areMappingsSubsetOfSchemas( - map[string]map[string]*sqlmanager_shared.ColumnInfo{ + map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{ "public.users": { - "id": &sqlmanager_shared.ColumnInfo{}, + "id": &sqlmanager_shared.DatabaseSchemaRow{}, }, }, []*mgmtv1alpha1.JobMapping{ @@ -259,10 +259,10 @@ func TestAreMappingsSubsetOfSchemas(t *testing.T) { func TestShouldHaltOnSchemaAddition(t *testing.T) { ok := shouldHaltOnSchemaAddition( - map[string]map[string]*sqlmanager_shared.ColumnInfo{ + map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{ "public.users": { - "id": &sqlmanager_shared.ColumnInfo{}, - "created_by": &sqlmanager_shared.ColumnInfo{}, + "id": &sqlmanager_shared.DatabaseSchemaRow{}, + "created_by": &sqlmanager_shared.DatabaseSchemaRow{}, }, }, []*mgmtv1alpha1.JobMapping{ @@ -273,13 +273,13 @@ func TestShouldHaltOnSchemaAddition(t *testing.T) { require.False(t, ok, "job mappings are valid set of database schemas") ok = shouldHaltOnSchemaAddition( - map[string]map[string]*sqlmanager_shared.ColumnInfo{ + map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{ "public.users": { - "id": &sqlmanager_shared.ColumnInfo{}, - "created_by": &sqlmanager_shared.ColumnInfo{}, + "id": &sqlmanager_shared.DatabaseSchemaRow{}, + "created_by": &sqlmanager_shared.DatabaseSchemaRow{}, }, "neosync_api.accounts": { - "id": &sqlmanager_shared.ColumnInfo{}, + "id": &sqlmanager_shared.DatabaseSchemaRow{}, }, }, []*mgmtv1alpha1.JobMapping{ @@ -290,10 +290,10 @@ func TestShouldHaltOnSchemaAddition(t *testing.T) { require.True(t, ok, "job mappings are missing database schema mappings") ok = shouldHaltOnSchemaAddition( - map[string]map[string]*sqlmanager_shared.ColumnInfo{ + map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{ "public.users": { - "id": &sqlmanager_shared.ColumnInfo{}, - "created_by": &sqlmanager_shared.ColumnInfo{}, + "id": &sqlmanager_shared.DatabaseSchemaRow{}, + "created_by": &sqlmanager_shared.DatabaseSchemaRow{}, }, }, []*mgmtv1alpha1.JobMapping{ @@ -303,10 +303,10 @@ func TestShouldHaltOnSchemaAddition(t *testing.T) { require.True(t, ok, "job mappings are missing table column") ok = shouldHaltOnSchemaAddition( - map[string]map[string]*sqlmanager_shared.ColumnInfo{ + map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{ "public.users": { - "id": &sqlmanager_shared.ColumnInfo{}, - "created_by": &sqlmanager_shared.ColumnInfo{}, + "id": &sqlmanager_shared.DatabaseSchemaRow{}, + "created_by": &sqlmanager_shared.DatabaseSchemaRow{}, }, }, []*mgmtv1alpha1.JobMapping{ @@ -323,24 +323,24 @@ func Test_buildProcessorConfigsMutation(t *testing.T) { ctx := context.Background() runconfig := tabledependency.NewRunConfig("public.users", tabledependency.RunTypeInsert, []string{}, nil, []string{}, []string{}, []*tabledependency.DependsOn{}, false) - output, err := buildProcessorConfigs(ctx, mockTransformerClient, []*mgmtv1alpha1.JobMapping{}, map[string]*sqlmanager_shared.ColumnInfo{}, map[string][]*bb_internal.ReferenceKey{}, []string{}, mockJobId, mockRunId, nil, runconfig, nil, []string{}) + output, err := buildProcessorConfigs(ctx, mockTransformerClient, []*mgmtv1alpha1.JobMapping{}, map[string]*sqlmanager_shared.DatabaseSchemaRow{}, map[string][]*bb_internal.ReferenceKey{}, []string{}, mockJobId, mockRunId, nil, runconfig, nil, []string{}) require.Nil(t, err) require.Empty(t, output) - output, err = buildProcessorConfigs(ctx, mockTransformerClient, []*mgmtv1alpha1.JobMapping{}, map[string]*sqlmanager_shared.ColumnInfo{}, map[string][]*bb_internal.ReferenceKey{}, []string{}, mockJobId, mockRunId, nil, runconfig, nil, []string{}) + output, err = buildProcessorConfigs(ctx, mockTransformerClient, []*mgmtv1alpha1.JobMapping{}, map[string]*sqlmanager_shared.DatabaseSchemaRow{}, map[string][]*bb_internal.ReferenceKey{}, []string{}, mockJobId, mockRunId, nil, runconfig, nil, []string{}) require.Nil(t, err) require.Empty(t, output) runconfig = tabledependency.NewRunConfig("public.users", tabledependency.RunTypeInsert, []string{}, nil, []string{}, []string{"id"}, []*tabledependency.DependsOn{}, false) output, err = buildProcessorConfigs(ctx, mockTransformerClient, []*mgmtv1alpha1.JobMapping{ {Schema: "public", Table: "users", Column: "id"}, - }, map[string]*sqlmanager_shared.ColumnInfo{}, map[string][]*bb_internal.ReferenceKey{}, []string{}, mockJobId, mockRunId, nil, runconfig, nil, []string{}) + }, map[string]*sqlmanager_shared.DatabaseSchemaRow{}, map[string][]*bb_internal.ReferenceKey{}, []string{}, mockJobId, mockRunId, nil, runconfig, nil, []string{}) require.Nil(t, err) require.Empty(t, output) output, err = buildProcessorConfigs(ctx, mockTransformerClient, []*mgmtv1alpha1.JobMapping{ {Schema: "public", Table: "users", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{}}, - }, map[string]*sqlmanager_shared.ColumnInfo{}, map[string][]*bb_internal.ReferenceKey{}, []string{}, mockJobId, mockRunId, nil, runconfig, nil, []string{}) + }, map[string]*sqlmanager_shared.DatabaseSchemaRow{}, map[string][]*bb_internal.ReferenceKey{}, []string{}, mockJobId, mockRunId, nil, runconfig, nil, []string{}) require.Nil(t, err) require.Empty(t, output) @@ -348,7 +348,7 @@ func Test_buildProcessorConfigsMutation(t *testing.T) { {Schema: "public", Table: "users", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{Config: &mgmtv1alpha1.TransformerConfig{ Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{}, }}}, - }, map[string]*sqlmanager_shared.ColumnInfo{}, map[string][]*bb_internal.ReferenceKey{}, []string{}, mockJobId, mockRunId, nil, runconfig, nil, []string{}) + }, map[string]*sqlmanager_shared.DatabaseSchemaRow{}, map[string][]*bb_internal.ReferenceKey{}, []string{}, mockJobId, mockRunId, nil, runconfig, nil, []string{}) require.Nil(t, err) require.Empty(t, output) @@ -364,7 +364,7 @@ func Test_buildProcessorConfigsMutation(t *testing.T) { Nullconfig: &mgmtv1alpha1.Null{}, }, }}}, - }, map[string]*sqlmanager_shared.ColumnInfo{}, map[string][]*bb_internal.ReferenceKey{}, []string{}, mockJobId, mockRunId, nil, runconfig, nil, []string{}) + }, map[string]*sqlmanager_shared.DatabaseSchemaRow{}, map[string][]*bb_internal.ReferenceKey{}, []string{}, mockJobId, mockRunId, nil, runconfig, nil, []string{}) require.Nil(t, err) @@ -384,16 +384,16 @@ func Test_buildProcessorConfigsMutation(t *testing.T) { emailLength := 40 - groupedSchemas := map[string]*sqlmanager_shared.ColumnInfo{ + groupedSchemas := map[string]*sqlmanager_shared.DatabaseSchemaRow{ "email": { OrdinalPosition: 2, ColumnDefault: "", IsNullable: true, DataType: "timestamptz", - CharacterMaximumLength: &emailLength, - NumericPrecision: nil, - NumericScale: nil, + CharacterMaximumLength: emailLength, + NumericPrecision: 0, + NumericScale: 0, }, } @@ -447,7 +447,7 @@ func Test_buildProcessorConfigsJavascriptEmpty(t *testing.T) { runconfig := tabledependency.NewRunConfig("public.users", tabledependency.RunTypeInsert, []string{"id"}, nil, []string{"id"}, []string{"id"}, []*tabledependency.DependsOn{}, false) resp, err := buildProcessorConfigs(ctx, mockTransformerClient, []*mgmtv1alpha1.JobMapping{ - {Schema: "public", Table: "users", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{Config: jsT.Config}}}, map[string]*sqlmanager_shared.ColumnInfo{}, map[string][]*bb_internal.ReferenceKey{}, []string{}, mockJobId, mockRunId, nil, runconfig, nil, + {Schema: "public", Table: "users", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{Config: jsT.Config}}}, map[string]*sqlmanager_shared.DatabaseSchemaRow{}, map[string][]*bb_internal.ReferenceKey{}, []string{}, mockJobId, mockRunId, nil, runconfig, nil, []string{}) require.NoError(t, err) @@ -604,7 +604,7 @@ func Test_computeMutationFunction_null(t *testing.T) { Transformer: &mgmtv1alpha1.JobMappingTransformer{ Config: &mgmtv1alpha1.TransformerConfig{Config: &mgmtv1alpha1.TransformerConfig_Nullconfig{}}, }, - }, &sqlmanager_shared.ColumnInfo{}, false) + }, &sqlmanager_shared.DatabaseSchemaRow{}, false) require.NoError(t, err) require.Equal(t, val, "null") } @@ -985,14 +985,14 @@ func Test_computeMutationFunction_Validate_Bloblang_Output(t *testing.T) { }, } - emailColInfo := &sqlmanager_shared.ColumnInfo{ + emailColInfo := &sqlmanager_shared.DatabaseSchemaRow{ OrdinalPosition: 2, ColumnDefault: "", IsNullable: true, DataType: "timestamptz", - CharacterMaximumLength: shared.Ptr(40), - NumericPrecision: nil, - NumericScale: nil, + CharacterMaximumLength: 40, + NumericPrecision: 0, + NumericScale: 0, } for _, transformer := range transformers { @@ -1134,14 +1134,14 @@ func Test_computeMutationFunction_Validate_Bloblang_Output_EmptyConfigs(t *testi }, } - emailColInfo := &sqlmanager_shared.ColumnInfo{ + emailColInfo := &sqlmanager_shared.DatabaseSchemaRow{ OrdinalPosition: 2, ColumnDefault: "", IsNullable: true, DataType: "timestamptz", - CharacterMaximumLength: shared.Ptr(40), - NumericPrecision: nil, - NumericScale: nil, + CharacterMaximumLength: 40, + NumericPrecision: 0, + NumericScale: 0, } for _, transformer := range transformers { @@ -1165,7 +1165,7 @@ func Test_computeMutationFunction_Validate_Bloblang_Output_EmptyConfigs(t *testi func Test_computeMutationFunction_handles_Db_Maxlen(t *testing.T) { type testcase struct { jm *mgmtv1alpha1.JobMapping - ci *sqlmanager_shared.ColumnInfo + ci *sqlmanager_shared.DatabaseSchemaRow expected string } jm := &mgmtv1alpha1.JobMapping{ @@ -1183,48 +1183,48 @@ func Test_computeMutationFunction_handles_Db_Maxlen(t *testing.T) { testcases := []testcase{ { jm: jm, - ci: &sqlmanager_shared.ColumnInfo{}, + ci: &sqlmanager_shared.DatabaseSchemaRow{}, expected: "generate_string(min:2,max:7)", }, { jm: jm, - ci: &sqlmanager_shared.ColumnInfo{ - CharacterMaximumLength: nil, + ci: &sqlmanager_shared.DatabaseSchemaRow{ + CharacterMaximumLength: 0, }, expected: "generate_string(min:2,max:7)", }, { jm: jm, - ci: &sqlmanager_shared.ColumnInfo{ - CharacterMaximumLength: shared.Ptr(-1), + ci: &sqlmanager_shared.DatabaseSchemaRow{ + CharacterMaximumLength: -1, }, expected: "generate_string(min:2,max:7)", }, { jm: jm, - ci: &sqlmanager_shared.ColumnInfo{ - CharacterMaximumLength: shared.Ptr(0), + ci: &sqlmanager_shared.DatabaseSchemaRow{ + CharacterMaximumLength: 0, }, expected: "generate_string(min:2,max:7)", }, { jm: jm, - ci: &sqlmanager_shared.ColumnInfo{ - CharacterMaximumLength: shared.Ptr(10), + ci: &sqlmanager_shared.DatabaseSchemaRow{ + CharacterMaximumLength: 10, }, expected: "generate_string(min:2,max:7)", }, { jm: jm, - ci: &sqlmanager_shared.ColumnInfo{ - CharacterMaximumLength: shared.Ptr(3), + ci: &sqlmanager_shared.DatabaseSchemaRow{ + CharacterMaximumLength: 3, }, expected: "generate_string(min:2,max:3)", }, { jm: jm, - ci: &sqlmanager_shared.ColumnInfo{ - CharacterMaximumLength: shared.Ptr(1), + ci: &sqlmanager_shared.DatabaseSchemaRow{ + CharacterMaximumLength: 1, }, expected: "generate_string(min:1,max:1)", }, diff --git a/internal/benthos/benthos-builder/builders/dynamodb.go b/internal/benthos/benthos-builder/builders/dynamodb.go index 6e8bcfa30f..7d2d105114 100644 --- a/internal/benthos/benthos-builder/builders/dynamodb.go +++ b/internal/benthos/benthos-builder/builders/dynamodb.go @@ -107,7 +107,7 @@ func (b *dyanmodbSyncBuilder) BuildSourceConfigs(ctx context.Context, params *bb params.RunId, &shared.RedisConfig{}, tableMapping.Mappings, - map[string]*sqlmanager_shared.ColumnInfo{}, + map[string]*sqlmanager_shared.DatabaseSchemaRow{}, job.GetSource().GetOptions(), mappedKeys, ) diff --git a/internal/benthos/benthos-builder/builders/mongodb.go b/internal/benthos/benthos-builder/builders/mongodb.go index 5bfbf6814b..5cecfaaa86 100644 --- a/internal/benthos/benthos-builder/builders/mongodb.go +++ b/internal/benthos/benthos-builder/builders/mongodb.go @@ -76,7 +76,7 @@ func (b *mongodbSyncBuilder) BuildSourceConfigs(ctx context.Context, params *bb_ params.RunId, &shared.RedisConfig{}, tableMapping.Mappings, - map[string]*sqlmanager_shared.ColumnInfo{}, + map[string]*sqlmanager_shared.DatabaseSchemaRow{}, job.GetSource().GetOptions(), columns, ) diff --git a/internal/benthos/benthos-builder/builders/processors.go b/internal/benthos/benthos-builder/builders/processors.go index 99cce08925..3ccf4da2e8 100644 --- a/internal/benthos/benthos-builder/builders/processors.go +++ b/internal/benthos/benthos-builder/builders/processors.go @@ -32,7 +32,7 @@ func buildProcessorConfigsByRunType( jobId, runId string, redisConfig *shared.RedisConfig, mappings []*mgmtv1alpha1.JobMapping, - columnInfoMap map[string]*sqlmanager_shared.ColumnInfo, + columnInfoMap map[string]*sqlmanager_shared.DatabaseSchemaRow, jobSourceOptions *mgmtv1alpha1.JobSourceOptions, mappedKeys []string, ) ([]*neosync_benthos.ProcessorConfig, error) { @@ -123,7 +123,7 @@ func buildProcessorConfigs( ctx context.Context, transformerclient mgmtv1alpha1connect.TransformersServiceClient, cols []*mgmtv1alpha1.JobMapping, - tableColumnInfo map[string]*sqlmanager_shared.ColumnInfo, + tableColumnInfo map[string]*sqlmanager_shared.DatabaseSchemaRow, transformedFktoPkMap map[string][]*bb_internal.ReferenceKey, fkSourceCols []string, jobId, runId string, @@ -262,7 +262,7 @@ func buildMutationConfigs( ctx context.Context, transformerclient mgmtv1alpha1connect.TransformersServiceClient, cols []*mgmtv1alpha1.JobMapping, - tableColumnInfo map[string]*sqlmanager_shared.ColumnInfo, + tableColumnInfo map[string]*sqlmanager_shared.DatabaseSchemaRow, splitColumnPaths bool, ) (string, error) { mutations := []string{} @@ -485,10 +485,10 @@ function transformers root.{destination_col} = transformerfunction(args) */ -func computeMutationFunction(col *mgmtv1alpha1.JobMapping, colInfo *sqlmanager_shared.ColumnInfo, splitColumnPath bool) (string, error) { +func computeMutationFunction(col *mgmtv1alpha1.JobMapping, colInfo *sqlmanager_shared.DatabaseSchemaRow, splitColumnPath bool) (string, error) { var maxLen int64 = 10000 - if colInfo != nil && colInfo.CharacterMaximumLength != nil && *colInfo.CharacterMaximumLength > 0 { - maxLen = int64(*colInfo.CharacterMaximumLength) + if colInfo != nil && colInfo.CharacterMaximumLength > 0 { + maxLen = int64(colInfo.CharacterMaximumLength) } formattedColPath := getBenthosColumnKey(col.Column, splitColumnPath) @@ -550,8 +550,8 @@ func computeMutationFunction(col *mgmtv1alpha1.JobMapping, colInfo *sqlmanager_s precision = &userDefinedPrecision cfg.GenerateFloat64Config.Precision = &userDefinedPrecision } - if colInfo != nil && colInfo.NumericPrecision != nil && *colInfo.NumericPrecision > 0 { - newPrecision := transformer_utils.Ceil(*precision, int64(*colInfo.NumericPrecision)) + if colInfo != nil && colInfo.NumericPrecision > 0 { + newPrecision := transformer_utils.Ceil(*precision, int64(colInfo.NumericPrecision)) precision = &newPrecision } if precision != nil { @@ -559,8 +559,8 @@ func computeMutationFunction(col *mgmtv1alpha1.JobMapping, colInfo *sqlmanager_s } var scale *int64 - if colInfo != nil && colInfo.NumericScale != nil && *colInfo.NumericScale >= 0 { - newScale := int64(*colInfo.NumericScale) + if colInfo != nil && colInfo.NumericScale >= 0 { + newScale := int64(colInfo.NumericScale) scale = &newScale } @@ -686,13 +686,13 @@ func computeMutationFunction(col *mgmtv1alpha1.JobMapping, colInfo *sqlmanager_s return opts.BuildBloblangString(formattedColPath), nil case *mgmtv1alpha1.TransformerConfig_TransformFloat64Config: var precision *int64 - if colInfo != nil && colInfo.NumericPrecision != nil && *colInfo.NumericPrecision > 0 { - newPrecision := int64(*colInfo.NumericPrecision) + if colInfo != nil && colInfo.NumericPrecision > 0 { + newPrecision := int64(colInfo.NumericPrecision) precision = &newPrecision } var scale *int64 - if colInfo != nil && colInfo.NumericScale != nil && *colInfo.NumericScale >= 0 { - newScale := int64(*colInfo.NumericScale) + if colInfo != nil && colInfo.NumericScale >= 0 { + newScale := int64(colInfo.NumericScale) scale = &newScale } opts, err := transformers.NewTransformFloat64OptsFromConfig(cfg.TransformFloat64Config, scale, precision) diff --git a/internal/benthos/benthos-builder/builders/processors_test.go b/internal/benthos/benthos-builder/builders/processors_test.go index 9a4fa0f4cd..b535e19995 100644 --- a/internal/benthos/benthos-builder/builders/processors_test.go +++ b/internal/benthos/benthos-builder/builders/processors_test.go @@ -65,7 +65,7 @@ func Test_buildProcessorConfigsJavascript(t *testing.T) { Schema: "public", Table: "users", Column: "address", Transformer: &mgmtv1alpha1.JobMappingTransformer{Config: jsT.Config}, }}, - map[string]*sqlmanager_shared.ColumnInfo{}, + map[string]*sqlmanager_shared.DatabaseSchemaRow{}, map[string][]*bb_internal.ReferenceKey{}, []string{}, mockJobId, mockRunId, nil, tabledependency.NewRunConfig("", tabledependency.RunTypeInsert, nil, nil, nil, []string{"address"}, nil, false), nil, @@ -124,7 +124,7 @@ func Test_buildProcessorConfigsGenerateJavascript(t *testing.T) { {Schema: "public", Table: "users", Column: "test", Transformer: &mgmtv1alpha1.JobMappingTransformer{Config: jsT.Config}, }}, - map[string]*sqlmanager_shared.ColumnInfo{}, + map[string]*sqlmanager_shared.DatabaseSchemaRow{}, map[string][]*bb_internal.ReferenceKey{}, []string{}, mockJobId, mockRunId, nil, tabledependency.NewRunConfig("", tabledependency.RunTypeInsert, nil, nil, nil, []string{"test"}, nil, false), nil, @@ -193,7 +193,7 @@ func Test_buildProcessorConfigsJavascriptMultiple(t *testing.T) { []*mgmtv1alpha1.JobMapping{ {Schema: "public", Table: "users", Column: nameCol, Transformer: &mgmtv1alpha1.JobMappingTransformer{Config: jsT.Config}}, {Schema: "public", Table: "users", Column: ageCol, Transformer: &mgmtv1alpha1.JobMappingTransformer{Config: jsT2.Config}}}, - map[string]*sqlmanager_shared.ColumnInfo{}, map[string][]*bb_internal.ReferenceKey{}, []string{}, mockJobId, mockRunId, nil, + map[string]*sqlmanager_shared.DatabaseSchemaRow{}, map[string][]*bb_internal.ReferenceKey{}, []string{}, mockJobId, mockRunId, nil, tabledependency.NewRunConfig("", tabledependency.RunTypeInsert, nil, nil, nil, []string{nameCol, ageCol}, nil, false), nil, []string{}, @@ -262,7 +262,7 @@ func Test_buildProcessorConfigsTransformAndGenerateJavascript(t *testing.T) { []*mgmtv1alpha1.JobMapping{ {Schema: "public", Table: "users", Column: nameCol, Transformer: &mgmtv1alpha1.JobMappingTransformer{Config: jsT.Config}}, {Schema: "public", Table: "users", Column: col2, Transformer: &mgmtv1alpha1.JobMappingTransformer{Config: jsT2.Config}}}, - map[string]*sqlmanager_shared.ColumnInfo{}, map[string][]*bb_internal.ReferenceKey{}, []string{}, mockJobId, mockRunId, nil, + map[string]*sqlmanager_shared.DatabaseSchemaRow{}, map[string][]*bb_internal.ReferenceKey{}, []string{}, mockJobId, mockRunId, nil, tabledependency.NewRunConfig("", tabledependency.RunTypeInsert, nil, nil, nil, []string{nameCol, col2}, nil, false), nil, []string{}, @@ -321,7 +321,7 @@ func Test_buildProcessorConfigsJavascript_DeepKeys(t *testing.T) { Schema: "public", Table: "users", Column: "foo.bar.baz", Transformer: &mgmtv1alpha1.JobMappingTransformer{Config: jsT.Config}, }}, - map[string]*sqlmanager_shared.ColumnInfo{}, + map[string]*sqlmanager_shared.DatabaseSchemaRow{}, map[string][]*bb_internal.ReferenceKey{}, []string{}, mockJobId, mockRunId, nil, tabledependency.NewRunConfig("", tabledependency.RunTypeInsert, nil, nil, nil, []string{"foo.bar.baz"}, nil, false), nil, diff --git a/internal/benthos/benthos-builder/builders/sql-util.go b/internal/benthos/benthos-builder/builders/sql-util.go index f9906e60dc..a133172fd8 100644 --- a/internal/benthos/benthos-builder/builders/sql-util.go +++ b/internal/benthos/benthos-builder/builders/sql-util.go @@ -46,7 +46,7 @@ type tableMapping struct { } func areMappingsSubsetOfSchemas( - groupedSchemas map[string]map[string]*sqlmanager_shared.ColumnInfo, + groupedSchemas map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow, mappings []*mgmtv1alpha1.JobMapping, ) bool { tableColMappings := getUniqueColMappingsMap(mappings) @@ -99,7 +99,7 @@ func getUniqueColMappingsMap( } func shouldHaltOnSchemaAddition( - groupedSchemas map[string]map[string]*sqlmanager_shared.ColumnInfo, + groupedSchemas map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow, mappings []*mgmtv1alpha1.JobMapping, ) bool { tableColMappings := getUniqueColMappingsMap(mappings) @@ -184,7 +184,7 @@ func groupSqlJobSourceOptionsByTable( func mergeVirtualForeignKeys( dbForeignKeys map[string][]*sqlmanager_shared.ForeignConstraint, virtualForeignKeys []*mgmtv1alpha1.VirtualForeignConstraint, - colInfoMap map[string]map[string]*sqlmanager_shared.ColumnInfo, + colInfoMap map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow, ) (map[string][]*sqlmanager_shared.ForeignConstraint, error) { fks := map[string][]*sqlmanager_shared.ForeignConstraint{} @@ -411,7 +411,7 @@ func getColumnDefaultProperties( slogger *slog.Logger, driver string, cols []string, - colInfo map[string]*sqlmanager_shared.ColumnInfo, + colInfo map[string]*sqlmanager_shared.DatabaseSchemaRow, colTransformers map[string]*mgmtv1alpha1.JobMappingTransformer, ) (map[string]*neosync_benthos.ColumnDefaultProperties, error) { colDefaults := map[string]*neosync_benthos.ColumnDefaultProperties{} diff --git a/internal/benthos/benthos-builder/builders/sql.go b/internal/benthos/benthos-builder/builders/sql.go index 6820cfcd7e..e9ae5866e6 100644 --- a/internal/benthos/benthos-builder/builders/sql.go +++ b/internal/benthos/benthos-builder/builders/sql.go @@ -28,10 +28,10 @@ type sqlSyncBuilder struct { // reverse of table dependency // map of foreign key to source table + column - primaryKeyToForeignKeysMap map[string]map[string][]*bb_internal.ReferenceKey // schema.table -> column -> ForeignKey - colTransformerMap map[string]map[string]*mgmtv1alpha1.JobMappingTransformer // schema.table -> column -> transformer - sqlSourceSchemaColumnInfoMap map[string]map[string]*sqlmanager_shared.ColumnInfo // schema.table -> column -> column info struct - sqlDestinationSchemaColumnInfoMap map[string]map[string]*sqlmanager_shared.ColumnInfo // schema.table -> column -> column info struct + primaryKeyToForeignKeysMap map[string]map[string][]*bb_internal.ReferenceKey // schema.table -> column -> ForeignKey + colTransformerMap map[string]map[string]*mgmtv1alpha1.JobMappingTransformer // schema.table -> column -> transformer + sqlSourceSchemaColumnInfoMap map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow // schema.table -> column -> column info struct + sqlDestinationSchemaColumnInfoMap map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow // schema.table -> column -> column info struct } func NewSqlSyncBuilder( @@ -134,7 +134,7 @@ func buildBenthosSqlSourceConfigResponses( dsnConnectionId string, driver string, tableRunTypeQueryMap map[string]map[tabledependency.RunType]string, - groupedColumnInfo map[string]map[string]*sqlmanager_shared.ColumnInfo, + groupedColumnInfo map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow, tableDependencies map[string][]*sqlmanager_shared.ForeignConstraint, colTransformerMap map[string]map[string]*mgmtv1alpha1.JobMappingTransformer, jobId, runId string, @@ -245,7 +245,7 @@ func (b *sqlSyncBuilder) BuildDestinationConfig(ctx context.Context, params *bb_ b.sqlDestinationSchemaColumnInfoMap = sqlSchemaColMap } - var colInfoMap map[string]*sqlmanager_shared.ColumnInfo + var colInfoMap map[string]*sqlmanager_shared.DatabaseSchemaRow colMap, ok := b.sqlDestinationSchemaColumnInfoMap[tableKey] if ok { colInfoMap = colMap @@ -426,10 +426,10 @@ func hasPassthroughIdentityColumn(columnDefaultProperties map[string]*neosync_be func getSqlSchemaColumnMap( ctx context.Context, destinationConnection *mgmtv1alpha1.Connection, - sourceSchemaColumnInfoMap map[string]map[string]*sqlmanager_shared.ColumnInfo, + sourceSchemaColumnInfoMap map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow, sqlmanagerclient sqlmanager.SqlManagerClient, slogger *slog.Logger, -) map[string]map[string]*sqlmanager_shared.ColumnInfo { +) map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow { schemaColMap := sourceSchemaColumnInfoMap switch destinationConnection.ConnectionConfig.Config.(type) { case *mgmtv1alpha1.ConnectionConfig_PgConfig, *mgmtv1alpha1.ConnectionConfig_MysqlConfig, *mgmtv1alpha1.ConnectionConfig_MssqlConfig: @@ -454,10 +454,10 @@ func getSqlSchemaColumnMap( // Merges source db column info with destination db col info // Destination db col info take precedence func mergeSourceDestinationColumnInfo( - sourceCols map[string]map[string]*sqlmanager_shared.ColumnInfo, - destCols map[string]map[string]*sqlmanager_shared.ColumnInfo, -) map[string]map[string]*sqlmanager_shared.ColumnInfo { - mergedCols := map[string]map[string]*sqlmanager_shared.ColumnInfo{} + sourceCols map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow, + destCols map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow, +) map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow { + mergedCols := map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{} for schemaTable, tableCols := range sourceCols { mergedCols[schemaTable] = tableCols @@ -465,7 +465,7 @@ func mergeSourceDestinationColumnInfo( for schemaTable, tableCols := range destCols { if _, ok := mergedCols[schemaTable]; !ok { - mergedCols[schemaTable] = make(map[string]*sqlmanager_shared.ColumnInfo) + mergedCols[schemaTable] = make(map[string]*sqlmanager_shared.DatabaseSchemaRow) } for colName, colInfo := range tableCols { mergedCols[schemaTable][colName] = colInfo diff --git a/internal/benthos/benthos-builder/shared/types.go b/internal/benthos/benthos-builder/shared/types.go index 534e78a893..0a77e0a662 100644 --- a/internal/benthos/benthos-builder/shared/types.go +++ b/internal/benthos/benthos-builder/shared/types.go @@ -28,7 +28,7 @@ type SelectQueryMapBuilder interface { tableFkConstraints map[string][]*sqlmanager_shared.ForeignConstraint, runConfigs []*tabledependency.RunConfig, subsetByForeignKeyConstraints bool, - groupedColumnInfo map[string]map[string]*sqlmanager_shared.ColumnInfo, + groupedColumnInfo map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow, ) (map[string]map[tabledependency.RunType]string, error) } diff --git a/worker/pkg/query-builder2/query-builder_integration_test.go b/worker/pkg/query-builder2/query-builder_integration_test.go index 6d305bdd4a..fa526de672 100644 --- a/worker/pkg/query-builder2/query-builder_integration_test.go +++ b/worker/pkg/query-builder2/query-builder_integration_test.go @@ -40,8 +40,8 @@ func (s *IntegrationTestSuite) Test_BuildQueryMap_DoubleReference() { buildRunConfig("genbenthosconfigs_querybuilder.item", tabledependency.RunTypeInsert, []string{"id"}, nil, []string{"id", "expense_id"}, []string{"id", "expense_id"}, []*tabledependency.DependsOn{{Table: "genbenthosconfigs_querybuilder.expense", Columns: []string{"id"}}}), } - columnInfo := map[string]map[string]*sqlmanager_shared.ColumnInfo{ - "genbenthosconfigs_querybuilder.company": {"id": &sqlmanager_shared.ColumnInfo{}}, + columnInfo := map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{ + "genbenthosconfigs_querybuilder.company": {"id": &sqlmanager_shared.DatabaseSchemaRow{}}, } expectedValues := map[string]map[string][]int64{ @@ -135,9 +135,9 @@ func (s *IntegrationTestSuite) Test_BuildQueryMap_DoubleRootSubset() { buildRunConfig("genbenthosconfigs_querybuilder.test_2_e", tabledependency.RunTypeInsert, []string{"id"}, nil, []string{"id", "c_id"}, []string{"id", "c_id"}, []*tabledependency.DependsOn{{Table: "genbenthosconfigs_querybuilder.test_2_c", Columns: []string{"id"}}}), } - columnInfo := map[string]map[string]*sqlmanager_shared.ColumnInfo{ - "genbenthosconfigs_querybuilder.test_2_x": {"id": &sqlmanager_shared.ColumnInfo{}}, - "genbenthosconfigs_querybuilder.test_2_b": {"id": &sqlmanager_shared.ColumnInfo{}}, + columnInfo := map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{ + "genbenthosconfigs_querybuilder.test_2_x": {"id": &sqlmanager_shared.DatabaseSchemaRow{}}, + "genbenthosconfigs_querybuilder.test_2_b": {"id": &sqlmanager_shared.DatabaseSchemaRow{}}, } expectedValues := map[string]map[string][]int64{ @@ -316,8 +316,8 @@ func (s *IntegrationTestSuite) Test_BuildQueryMap_MultipleRoots() { ), } - columnInfo := map[string]map[string]*sqlmanager_shared.ColumnInfo{ - "genbenthosconfigs_querybuilder.test_3_a": {"id": &sqlmanager_shared.ColumnInfo{}}, + columnInfo := map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{ + "genbenthosconfigs_querybuilder.test_3_a": {"id": &sqlmanager_shared.DatabaseSchemaRow{}}, } expectedValues := map[string]map[string][]int64{ @@ -462,8 +462,8 @@ func (s *IntegrationTestSuite) Test_BuildQueryMap_MultipleSubsets() { ), } - columnInfo := map[string]map[string]*sqlmanager_shared.ColumnInfo{ - "genbenthosconfigs_querybuilder.test_3_a": {"id": &sqlmanager_shared.ColumnInfo{}}, + columnInfo := map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{ + "genbenthosconfigs_querybuilder.test_3_a": {"id": &sqlmanager_shared.DatabaseSchemaRow{}}, } expectedValues := map[string]map[string][]int64{ @@ -591,8 +591,8 @@ func (s *IntegrationTestSuite) Test_BuildQueryMap_MultipleSubsets_SubsetsByForei ), } - columnInfo := map[string]map[string]*sqlmanager_shared.ColumnInfo{ - "genbenthosconfigs_querybuilder.test_3_a": {"id": &sqlmanager_shared.ColumnInfo{}}, + columnInfo := map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{ + "genbenthosconfigs_querybuilder.test_3_a": {"id": &sqlmanager_shared.DatabaseSchemaRow{}}, } expectedValues := map[string]map[string][]int64{ @@ -722,7 +722,7 @@ func (s *IntegrationTestSuite) Test_BuildQueryMap_CircularDependency() { ), } - columnInfo := map[string]map[string]*sqlmanager_shared.ColumnInfo{} + columnInfo := map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{} expectedValues := map[string]map[string][]int64{ "genbenthosconfigs_querybuilder.orders": { @@ -822,11 +822,11 @@ func (s *IntegrationTestSuite) Test_BuildQueryMap_NoForeignKeys() { ), } - columnInfo := map[string]map[string]*sqlmanager_shared.ColumnInfo{ - "genbenthosconfigs_querybuilder.company": {"id": &sqlmanager_shared.ColumnInfo{}}, - "genbenthosconfigs_querybuilder.test_2_x": {"id": &sqlmanager_shared.ColumnInfo{}}, - "genbenthosconfigs_querybuilder.test_2_b": {"id": &sqlmanager_shared.ColumnInfo{}}, - "genbenthosconfigs_querybuilder.test_2_a": {"id": &sqlmanager_shared.ColumnInfo{}}, + columnInfo := map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{ + "genbenthosconfigs_querybuilder.company": {"id": &sqlmanager_shared.DatabaseSchemaRow{}}, + "genbenthosconfigs_querybuilder.test_2_x": {"id": &sqlmanager_shared.DatabaseSchemaRow{}}, + "genbenthosconfigs_querybuilder.test_2_b": {"id": &sqlmanager_shared.DatabaseSchemaRow{}}, + "genbenthosconfigs_querybuilder.test_2_a": {"id": &sqlmanager_shared.DatabaseSchemaRow{}}, } expectedValues := map[string]map[string][]int64{ @@ -927,11 +927,11 @@ func (s *IntegrationTestSuite) Test_BuildQueryMap_NoForeignKeys_NoSubsets() { ), } - columnInfo := map[string]map[string]*sqlmanager_shared.ColumnInfo{ - "genbenthosconfigs_querybuilder.company": {"id": &sqlmanager_shared.ColumnInfo{}}, - "genbenthosconfigs_querybuilder.test_2_x": {"id": &sqlmanager_shared.ColumnInfo{}}, - "genbenthosconfigs_querybuilder.test_2_b": {"id": &sqlmanager_shared.ColumnInfo{}}, - "genbenthosconfigs_querybuilder.test_2_a": {"id": &sqlmanager_shared.ColumnInfo{}}, + columnInfo := map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{ + "genbenthosconfigs_querybuilder.company": {"id": &sqlmanager_shared.DatabaseSchemaRow{}}, + "genbenthosconfigs_querybuilder.test_2_x": {"id": &sqlmanager_shared.DatabaseSchemaRow{}}, + "genbenthosconfigs_querybuilder.test_2_b": {"id": &sqlmanager_shared.DatabaseSchemaRow{}}, + "genbenthosconfigs_querybuilder.test_2_a": {"id": &sqlmanager_shared.DatabaseSchemaRow{}}, } expectedCount := map[string]int{ @@ -1007,8 +1007,8 @@ func (s *IntegrationTestSuite) Test_BuildQueryMap_SubsetCompositeKeys() { ), } - columnInfo := map[string]map[string]*sqlmanager_shared.ColumnInfo{ - "genbenthosconfigs_querybuilder.division": {"id": &sqlmanager_shared.ColumnInfo{}}, + columnInfo := map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{ + "genbenthosconfigs_querybuilder.division": {"id": &sqlmanager_shared.DatabaseSchemaRow{}}, } expectedValues := map[string]map[string][]int64{ @@ -1203,58 +1203,58 @@ func (s *IntegrationTestSuite) Test_BuildQueryMap_ComplexSubset_Postgres() { ), } - columnInfoMap := map[string]map[string]*sqlmanager_shared.ColumnInfo{ + columnInfoMap := map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{ "genbenthosconfigs_querybuilder.attachments": { - "attachment_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 1, ColumnDefault: "nextval('attachments_attachment_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "comment_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 7, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "file_name": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "character varying(255)", CharacterMaximumLength: ptr(255), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "file_path": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 3, ColumnDefault: "", IsNullable: false, DataType: "character varying(255)", CharacterMaximumLength: ptr(255), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "initiative_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 6, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "task_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 5, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "uploaded_by": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, + "attachment_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 1, ColumnDefault: "nextval('attachments_attachment_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "comment_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 7, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "file_name": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "character varying(255)", CharacterMaximumLength: 255, NumericPrecision: -1, NumericScale: -1}, + "file_path": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 3, ColumnDefault: "", IsNullable: false, DataType: "character varying(255)", CharacterMaximumLength: 255, NumericPrecision: -1, NumericScale: -1}, + "initiative_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 6, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "task_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 5, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "uploaded_by": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, }, "genbenthosconfigs_querybuilder.comments": { - "comment_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 1, ColumnDefault: "nextval('comments_comment_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "content": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "text", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "created_at": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 3, ColumnDefault: "CURRENT_TIMESTAMP", IsNullable: true, DataType: "timestamp without time zone", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "initiative_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 6, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "parent_comment_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 7, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "task_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 5, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "user_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, + "comment_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 1, ColumnDefault: "nextval('comments_comment_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "content": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "text", CharacterMaximumLength: -1, NumericPrecision: -1, NumericScale: -1}, + "created_at": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 3, ColumnDefault: "CURRENT_TIMESTAMP", IsNullable: true, DataType: "timestamp without time zone", CharacterMaximumLength: -1, NumericPrecision: -1, NumericScale: -1}, + "initiative_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 6, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "parent_comment_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 7, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "task_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 5, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "user_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, }, "genbenthosconfigs_querybuilder.initiatives": { - "client_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 5, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "description": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 3, ColumnDefault: "", IsNullable: true, DataType: "text", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "initiative_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 1, ColumnDefault: "nextval('initiatives_initiative_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "lead_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "name": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "character varying(100)", CharacterMaximumLength: ptr(100), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, + "client_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 5, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "description": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 3, ColumnDefault: "", IsNullable: true, DataType: "text", CharacterMaximumLength: -1, NumericPrecision: -1, NumericScale: -1}, + "initiative_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 1, ColumnDefault: "nextval('initiatives_initiative_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "lead_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "name": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "character varying(100)", CharacterMaximumLength: 100, NumericPrecision: -1, NumericScale: -1}, }, "genbenthosconfigs_querybuilder.skills": { - "category": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 3, ColumnDefault: "", IsNullable: true, DataType: "character varying(100)", CharacterMaximumLength: ptr(100), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "name": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "character varying(100)", CharacterMaximumLength: ptr(100), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "skill_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 1, ColumnDefault: "nextval('skills_skill_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, + "category": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 3, ColumnDefault: "", IsNullable: true, DataType: "character varying(100)", CharacterMaximumLength: 100, NumericPrecision: -1, NumericScale: -1}, + "name": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "character varying(100)", CharacterMaximumLength: 100, NumericPrecision: -1, NumericScale: -1}, + "skill_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 1, ColumnDefault: "nextval('skills_skill_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, }, "genbenthosconfigs_querybuilder.tasks": { - "assignee_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 6, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "description": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 3, ColumnDefault: "", IsNullable: true, DataType: "text", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "initiative_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 5, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "reviewer_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 7, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "status": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "character varying(50)", CharacterMaximumLength: ptr(50), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "task_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 1, ColumnDefault: "nextval('tasks_task_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "title": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "character varying(200)", CharacterMaximumLength: ptr(200), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, + "assignee_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 6, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "description": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 3, ColumnDefault: "", IsNullable: true, DataType: "text", CharacterMaximumLength: -1, NumericPrecision: -1, NumericScale: -1}, + "initiative_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 5, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "reviewer_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 7, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "status": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "character varying(50)", CharacterMaximumLength: 50, NumericPrecision: -1, NumericScale: -1}, + "task_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 1, ColumnDefault: "nextval('tasks_task_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "title": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "character varying(200)", CharacterMaximumLength: 200, NumericPrecision: -1, NumericScale: -1}, }, "genbenthosconfigs_querybuilder.user_skills": { - "proficiency_level": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "skill_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 3, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "user_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 2, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "user_skill_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 1, ColumnDefault: "nextval('user_skills_user_skill_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, + "proficiency_level": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "skill_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 3, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "user_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 2, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "user_skill_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 1, ColumnDefault: "nextval('user_skills_user_skill_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, }, "genbenthosconfigs_querybuilder.users": { - "email": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 3, ColumnDefault: "", IsNullable: false, DataType: "character varying(100)", CharacterMaximumLength: ptr(100), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "manager_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "mentor_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 5, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "name": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "character varying(100)", CharacterMaximumLength: ptr(100), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "user_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 1, ColumnDefault: "nextval('users_user_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, + "email": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 3, ColumnDefault: "", IsNullable: false, DataType: "character varying(100)", CharacterMaximumLength: 100, NumericPrecision: -1, NumericScale: -1}, + "manager_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "mentor_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 5, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "name": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "character varying(100)", CharacterMaximumLength: 100, NumericPrecision: -1, NumericScale: -1}, + "user_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 1, ColumnDefault: "nextval('users_user_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, }, } @@ -1383,26 +1383,26 @@ func (s *IntegrationTestSuite) Test_BuildQueryMap_Pruned_Joins() { ), } - columnInfoMap := map[string]map[string]*sqlmanager_shared.ColumnInfo{ + columnInfoMap := map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{ "genbenthosconfigs_querybuilder.network_types": { - "id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 1, ColumnDefault: "", IsNullable: false, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "name": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 1, ColumnDefault: "", IsNullable: false, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, + "id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 1, ColumnDefault: "", IsNullable: false, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "name": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 1, ColumnDefault: "", IsNullable: false, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, }, "genbenthosconfigs_querybuilder.networks": { - "id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 1, ColumnDefault: "", IsNullable: false, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "name": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "text", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "address": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 3, ColumnDefault: "", IsNullable: false, DataType: "timestamp without time zone", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "network_type_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 6, ColumnDefault: "", IsNullable: false, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, + "id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 1, ColumnDefault: "", IsNullable: false, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "name": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "text", CharacterMaximumLength: -1, NumericPrecision: -1, NumericScale: -1}, + "address": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 3, ColumnDefault: "", IsNullable: false, DataType: "timestamp without time zone", CharacterMaximumLength: -1, NumericPrecision: -1, NumericScale: -1}, + "network_type_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 6, ColumnDefault: "", IsNullable: false, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, }, "genbenthosconfigs_querybuilder.network_users": { - "id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 1, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "username": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 2, ColumnDefault: "", IsNullable: true, DataType: "text", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "email": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 3, ColumnDefault: "", IsNullable: false, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "password_hash": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 4, ColumnDefault: "", IsNullable: false, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "first_name": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 5, ColumnDefault: "", IsNullable: false, DataType: "character varying(100)", CharacterMaximumLength: ptr(100), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "last_name": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 6, ColumnDefault: "", IsNullable: false, DataType: "character varying(100)", CharacterMaximumLength: ptr(100), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "network_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 7, ColumnDefault: "", IsNullable: true, DataType: "character varying(100)", CharacterMaximumLength: ptr(100), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "created_at": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 8, ColumnDefault: "", IsNullable: false, DataType: "character varying(100)", CharacterMaximumLength: ptr(100), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, + "id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 1, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "username": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 2, ColumnDefault: "", IsNullable: true, DataType: "text", CharacterMaximumLength: -1, NumericPrecision: -1, NumericScale: -1}, + "email": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 3, ColumnDefault: "", IsNullable: false, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "password_hash": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 4, ColumnDefault: "", IsNullable: false, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "first_name": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 5, ColumnDefault: "", IsNullable: false, DataType: "character varying(100)", CharacterMaximumLength: 100, NumericPrecision: -1, NumericScale: -1}, + "last_name": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 6, ColumnDefault: "", IsNullable: false, DataType: "character varying(100)", CharacterMaximumLength: 100, NumericPrecision: -1, NumericScale: -1}, + "network_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 7, ColumnDefault: "", IsNullable: true, DataType: "character varying(100)", CharacterMaximumLength: 100, NumericPrecision: -1, NumericScale: -1}, + "created_at": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 8, ColumnDefault: "", IsNullable: false, DataType: "character varying(100)", CharacterMaximumLength: 100, NumericPrecision: -1, NumericScale: -1}, }, } @@ -1607,58 +1607,58 @@ func (s *IntegrationTestSuite) Test_BuildQueryMap_ComplexSubset_Mssql() { ), } - columnInfoMap := map[string]map[string]*sqlmanager_shared.ColumnInfo{ + columnInfoMap := map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow{ "mssqltest.attachments": { - "attachment_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 1, ColumnDefault: "nextval('attachments_attachment_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "comment_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 7, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "file_name": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "character varying(255)", CharacterMaximumLength: ptr(255), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "file_path": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 3, ColumnDefault: "", IsNullable: false, DataType: "character varying(255)", CharacterMaximumLength: ptr(255), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "initiative_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 6, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "task_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 5, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "uploaded_by": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, + "attachment_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 1, ColumnDefault: "nextval('attachments_attachment_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "comment_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 7, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "file_name": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "character varying(255)", CharacterMaximumLength: 255, NumericPrecision: -1, NumericScale: -1}, + "file_path": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 3, ColumnDefault: "", IsNullable: false, DataType: "character varying(255)", CharacterMaximumLength: 255, NumericPrecision: -1, NumericScale: -1}, + "initiative_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 6, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "task_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 5, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "uploaded_by": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, }, "mssqltest.comments": { - "comment_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 1, ColumnDefault: "nextval('comments_comment_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "content": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "text", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "created_at": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 3, ColumnDefault: "CURRENT_TIMESTAMP", IsNullable: true, DataType: "timestamp without time zone", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "initiative_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 6, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "parent_comment_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 7, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "task_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 5, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "user_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, + "comment_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 1, ColumnDefault: "nextval('comments_comment_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "content": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "text", CharacterMaximumLength: -1, NumericPrecision: -1, NumericScale: -1}, + "created_at": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 3, ColumnDefault: "CURRENT_TIMESTAMP", IsNullable: true, DataType: "timestamp without time zone", CharacterMaximumLength: -1, NumericPrecision: -1, NumericScale: -1}, + "initiative_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 6, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "parent_comment_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 7, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "task_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 5, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "user_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, }, "mssqltest.initiatives": { - "client_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 5, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "description": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 3, ColumnDefault: "", IsNullable: true, DataType: "text", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "initiative_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 1, ColumnDefault: "nextval('initiatives_initiative_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "lead_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "name": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "character varying(100)", CharacterMaximumLength: ptr(100), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, + "client_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 5, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "description": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 3, ColumnDefault: "", IsNullable: true, DataType: "text", CharacterMaximumLength: -1, NumericPrecision: -1, NumericScale: -1}, + "initiative_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 1, ColumnDefault: "nextval('initiatives_initiative_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "lead_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "name": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "character varying(100)", CharacterMaximumLength: 100, NumericPrecision: -1, NumericScale: -1}, }, "mssqltest.skills": { - "category": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 3, ColumnDefault: "", IsNullable: true, DataType: "character varying(100)", CharacterMaximumLength: ptr(100), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "name": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "character varying(100)", CharacterMaximumLength: ptr(100), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "skill_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 1, ColumnDefault: "nextval('skills_skill_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, + "category": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 3, ColumnDefault: "", IsNullable: true, DataType: "character varying(100)", CharacterMaximumLength: 100, NumericPrecision: -1, NumericScale: -1}, + "name": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "character varying(100)", CharacterMaximumLength: 100, NumericPrecision: -1, NumericScale: -1}, + "skill_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 1, ColumnDefault: "nextval('skills_skill_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, }, "mssqltest.tasks": { - "assignee_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 6, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "description": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 3, ColumnDefault: "", IsNullable: true, DataType: "text", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "initiative_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 5, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "reviewer_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 7, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "status": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "character varying(50)", CharacterMaximumLength: ptr(50), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "task_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 1, ColumnDefault: "nextval('tasks_task_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "title": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "character varying(200)", CharacterMaximumLength: ptr(200), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, + "assignee_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 6, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "description": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 3, ColumnDefault: "", IsNullable: true, DataType: "text", CharacterMaximumLength: -1, NumericPrecision: -1, NumericScale: -1}, + "initiative_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 5, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "reviewer_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 7, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "status": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "character varying(50)", CharacterMaximumLength: 50, NumericPrecision: -1, NumericScale: -1}, + "task_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 1, ColumnDefault: "nextval('tasks_task_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "title": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "character varying(200)", CharacterMaximumLength: 200, NumericPrecision: -1, NumericScale: -1}, }, "mssqltest.user_skills": { - "proficiency_level": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "skill_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 3, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "user_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 2, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "user_skill_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 1, ColumnDefault: "nextval('user_skills_user_skill_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, + "proficiency_level": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "skill_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 3, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "user_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 2, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "user_skill_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 1, ColumnDefault: "nextval('user_skills_user_skill_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, }, "mssqltest.users": { - "email": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 3, ColumnDefault: "", IsNullable: false, DataType: "character varying(100)", CharacterMaximumLength: ptr(100), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "manager_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "mentor_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 5, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, - "name": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "character varying(100)", CharacterMaximumLength: ptr(100), NumericPrecision: ptr(-1), NumericScale: ptr(-1)}, - "user_id": &sqlmanager_shared.ColumnInfo{OrdinalPosition: 1, ColumnDefault: "nextval('users_user_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: ptr(-1), NumericPrecision: ptr(32), NumericScale: ptr(0)}, + "email": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 3, ColumnDefault: "", IsNullable: false, DataType: "character varying(100)", CharacterMaximumLength: 100, NumericPrecision: -1, NumericScale: -1}, + "manager_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 4, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "mentor_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 5, ColumnDefault: "", IsNullable: true, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, + "name": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 2, ColumnDefault: "", IsNullable: false, DataType: "character varying(100)", CharacterMaximumLength: 100, NumericPrecision: -1, NumericScale: -1}, + "user_id": &sqlmanager_shared.DatabaseSchemaRow{OrdinalPosition: 1, ColumnDefault: "nextval('users_user_id_seq'::regclass)", IsNullable: false, DataType: "integer", CharacterMaximumLength: -1, NumericPrecision: 32, NumericScale: 0}, }, } diff --git a/worker/pkg/query-builder2/querybuilder.go b/worker/pkg/query-builder2/querybuilder.go index ba6b47a6a6..dc7e6b6385 100644 --- a/worker/pkg/query-builder2/querybuilder.go +++ b/worker/pkg/query-builder2/querybuilder.go @@ -74,7 +74,7 @@ type QueryBuilder struct { tables map[string]*TableInfo whereConditions map[string][]WhereCondition // schema.table -> column -> { column info } - columnInfo map[string]map[string]*sqlmanager_shared.ColumnInfo + columnInfo map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow defaultSchema string driver string subsetByForeignKeyConstraints bool @@ -83,7 +83,7 @@ type QueryBuilder struct { aliasCounter int } -func NewQueryBuilder(defaultSchema, driver string, subsetByForeignKeyConstraints bool, columnInfo map[string]map[string]*sqlmanager_shared.ColumnInfo) *QueryBuilder { +func NewQueryBuilder(defaultSchema, driver string, subsetByForeignKeyConstraints bool, columnInfo map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow) *QueryBuilder { return &QueryBuilder{ tables: make(map[string]*TableInfo), whereConditions: make(map[string][]WhereCondition), diff --git a/worker/pkg/query-builder2/subset.go b/worker/pkg/query-builder2/subset.go index 41737b239c..ad01fa9000 100644 --- a/worker/pkg/query-builder2/subset.go +++ b/worker/pkg/query-builder2/subset.go @@ -13,7 +13,7 @@ func BuildSelectQueryMap( tableFkConstraints map[string][]*sqlmanager_shared.ForeignConstraint, runConfigs []*tabledependency.RunConfig, subsetByForeignKeyConstraints bool, - groupedColumnInfo map[string]map[string]*sqlmanager_shared.ColumnInfo, + groupedColumnInfo map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow, ) (map[string]map[tabledependency.RunType]string, error) { tableDependencies := map[string]*TableConstraints{} for tableName, fkConstraints := range tableFkConstraints { @@ -71,7 +71,7 @@ type TableConstraints struct { } func NewQueryBuilderFromSchemaDefinition( - groupedColumnInfo map[string]map[string]*sqlmanager_shared.ColumnInfo, + groupedColumnInfo map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow, tableDependencies map[string]*TableConstraints, defaultSchema string, driver string, diff --git a/worker/pkg/query-builder2/wrapper.go b/worker/pkg/query-builder2/wrapper.go index 05804ae386..8211070cb7 100644 --- a/worker/pkg/query-builder2/wrapper.go +++ b/worker/pkg/query-builder2/wrapper.go @@ -14,7 +14,7 @@ func (w *QueryMapBuilderWrapper) BuildSelectQueryMap( tableFkConstraints map[string][]*sqlmanager_shared.ForeignConstraint, runConfigs []*tabledependency.RunConfig, subsetByForeignKeyConstraints bool, - groupedColumnInfo map[string]map[string]*sqlmanager_shared.ColumnInfo, + groupedColumnInfo map[string]map[string]*sqlmanager_shared.DatabaseSchemaRow, ) (map[string]map[tabledependency.RunType]string, error) { return BuildSelectQueryMap( driver,