lib/activefacts/generator/sql/postgres.rb in activefacts-compositions-1.9.15 vs lib/activefacts/generator/sql/postgres.rb in activefacts-compositions-1.9.16

- old
+ new

@@ -1,10 +1,13 @@ # -# ActiveFacts Standard SQL Schema Generator +# ActiveFacts PostgreSQL Schema Generator # -# Copyright (c) 2009-2016 Clifford Heath. Read the LICENSE file. +# Copyright (c) 2017 Clifford Heath. Read the LICENSE file. # +# Reserved words gathered from: +# https://www.postgresql.org/docs/9.5/static/sql-keywords-appendix.html +# require 'digest/sha1' require 'activefacts/metamodel' require 'activefacts/compositions' require 'activefacts/generator/sql' @@ -27,11 +30,11 @@ def table_name_max 63 end def data_type_context - PostgresqlDataTypeContext.new + PostgresDataTypeContext.new end def auto_assign_modifier '' end @@ -59,12 +62,12 @@ end else super end when MM::DataType::TYPE_Money; 'MONEY' - when MM::DataType::TYPE_DateTime; 'DATETIME' - when MM::DataType::TYPE_Timestamp;'DATETIME' + when MM::DataType::TYPE_DateTime; 'TIMESTAMP' + when MM::DataType::TYPE_Timestamp;'TIMESTAMP' when MM::DataType::TYPE_Binary; if length && length <= 8192 super else 'IMAGE' @@ -125,10 +128,10 @@ def index_kind(index) '' end - class PostgresqlDataTypeContext < SQLDataTypeContext + class PostgresDataTypeContext < SQLDataTypeContext def integer_ranges super end def boolean_type