Sha256: 0357ab355f9652aaf92391321bfb61470b06def702e94fe66b55440180a2e963

Contents?: true

Size: 1.31 KB

Versions: 30

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

module ActiveRecord
  module ConnectionAdapters
    module CipherStashPG
      class SchemaDumper < ConnectionAdapters::SchemaDumper # :nodoc:
        private
          def extensions(stream)
            extensions = @connection.extensions
            if extensions.any?
              stream.puts "  # These are extensions that must be enabled in order to support this database"
              extensions.sort.each do |extension|
                stream.puts "  enable_extension #{extension.inspect}"
              end
              stream.puts
            end
          end

          def prepare_column_options(column)
            spec = super
            spec[:array] = "true" if column.array?
            spec
          end

          def default_primary_key?(column)
            schema_type(column) == :bigserial
          end

          def explicit_primary_key_default?(column)
            column.type == :uuid || (column.type == :integer && !column.serial?)
          end

          def schema_type(column)
            return super unless column.serial?

            if column.bigint?
              :bigserial
            else
              :serial
            end
          end

          def schema_expression(column)
            super unless column.serial?
          end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
activerecord-cipherstash-pg-adapter-0.8.5 lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_dumper.rb
activerecord-cipherstash-pg-adapter-0.8.4 lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_dumper.rb
activerecord-cipherstash-pg-adapter-0.8.3 lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_dumper.rb
activerecord-cipherstash-pg-adapter-0.8.2 lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_dumper.rb
activerecord-cipherstash-pg-adapter-0.8.1 lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_dumper.rb
activerecord-cipherstash-pg-adapter-0.8.0 lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_dumper.rb
activerecord-cipherstash-pg-adapter-0.7.19 lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_dumper.rb
activerecord-cipherstash-pg-adapter-0.7.18 lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_dumper.rb
activerecord-cipherstash-pg-adapter-0.7.17 lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_dumper.rb
activerecord-cipherstash-pg-adapter-0.7.16 lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_dumper.rb
activerecord-cipherstash-pg-adapter-0.7.15 lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_dumper.rb
activerecord-cipherstash-pg-adapter-0.7.14 lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_dumper.rb
activerecord-cipherstash-pg-adapter-0.7.12 lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_dumper.rb
activerecord-cipherstash-pg-adapter-0.7.11 lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_dumper.rb
activerecord-cipherstash-pg-adapter-0.7.10 lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_dumper.rb
activerecord-cipherstash-pg-adapter-0.7.9 lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_dumper.rb
activerecord-cipherstash-pg-adapter-0.7.8 lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_dumper.rb
activerecord-cipherstash-pg-adapter-0.7.7 lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_dumper.rb
activerecord-cipherstash-pg-adapter-0.7.6 lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_dumper.rb
activerecord-cipherstash-pg-adapter-0.7.5 lib/active_record/connection_adapters/6.1/cipherstash_pg/schema_dumper.rb