Skip to content

Commit

Permalink
Fixed issues on postgresql schema:generate
Browse files Browse the repository at this point in the history
  • Loading branch information
dcarneir committed Feb 3, 2022
1 parent 6ba4123 commit a120ddb
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 deletions.
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.94] - 2022-02-03
### Fixed
- Exception on schema:generate with postgresql extensions
### Changed
- included 'alter session set nls_timestamp_format' on schema:recreate_oracle

## [1.93] - 2022-01-24
### Fixed
- temporary tables on PostgreSQL
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ mainClassName = "br.com.bluesoft.bee.Bee"

group = 'br.com.bluesoft.bee'
def artifact = 'bee'
version = '1.93'
version = '1.94'

def javaVersion = JavaVersion.VERSION_1_8
sourceCompatibility = javaVersion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,23 +232,25 @@ class PostgresDatabaseReader implements DatabaseReader {
def tableName = it.table_name.toLowerCase()
def table = tables[tableName]
def indexName = it.index_name.toLowerCase()
def indexAlreadyExists = table.indexes[indexName] ? true : false
def index = null;
if (indexAlreadyExists) {
index = table.indexes[indexName]
} else {
index = new Index()
index.name = indexName
index.type = getIndexType(it.index_type)
index.unique = it.uniqueness
def parts = (it.definition as String).split('\\) WHERE ')
index.where = parts.size() > 1 ? parts[1] : null
table.indexes[index.name] = index
if (table) {
def indexAlreadyExists = table.indexes[indexName] ? true : false
def index = null;
if (indexAlreadyExists) {
index = table.indexes[indexName]
} else {
index = new Index()
index.name = indexName
index.type = getIndexType(it.index_type)
index.unique = it.uniqueness
def parts = (it.definition as String).split('\\) WHERE ')
index.where = parts.size() > 1 ? parts[1] : null
table.indexes[index.name] = index
}
def indexColumn = new IndexColumn()
indexColumn.name = it.column_name.toLowerCase()
indexColumn.descend = it.descend.toLowerCase() == 'desc' ? true : false
index.columns << indexColumn
}
def indexColumn = new IndexColumn()
indexColumn.name = it.column_name.toLowerCase()
indexColumn.descend = it.descend.toLowerCase() == 'desc' ? true : false
index.columns << indexColumn
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class BeeOracleSchemaCreator extends BeeSchemaCreator {
void createCoreData(def file, def schema, def dataFolderPath) {
if (!schema.filtered) {
file.append("alter session set nls_date_format = 'yyyy-mm-dd';\n", 'utf-8')
file.append("alter session set nls_timestamp_format = 'yyyy-mm-dd hh24:mi:ss';\n", 'utf-8')
file.append("set define off;\n\n", 'utf-8')
super.createCoreData(file, schema, dataFolderPath)
}
Expand Down

0 comments on commit a120ddb

Please sign in to comment.