public void VerifyColumnType(CorrelationProperty correlationProperty) { string columnType; if (correlationProperty.Type == CorrelationPropertyType.String) { columnType = "character varying"; } else { columnType = PostgreSqlCorrelationPropertyTypeConverter.GetColumnType(correlationProperty.Type); } var name = correlationProperty.Name; writer.Write($@" columnType := ( select data_type from information_schema.columns where table_schema = schema and table_name = tableNameNonQuoted and column_name = 'Correlation_{name}' ); if columnType <> '{columnType}' then raise exception 'Incorrect data type for Correlation_{name}. Expected ""{columnType}"" got ""%""', columnType; end if; "); }
public void AddProperty(CorrelationProperty correlationProperty) { var columnType = PostgreSqlCorrelationPropertyTypeConverter.GetColumnType(correlationProperty.Type); var name = correlationProperty.Name; writer.Write($@" script = 'alter table ""' || schema || '"".""' || tableNameNonQuoted || '"" add column if not exists ""Correlation_{name}"" {columnType}'; execute script; "); }