Method: PgSync::Sync#map_deprecations

Defined in:
lib/pgsync/sync.rb

#map_deprecations(args, opts) ⇒ Object



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/pgsync/sync.rb', line 100

def map_deprecations(args, opts)
  command = args[0]

  case command
  when "schema"
    args.shift
    opts[:schema_only] = true
    deprecated "Use `psync --schema-only` instead"
  when "tables"
    args.shift
    opts[:tables] = args.shift
    deprecated "Use `pgsync #{opts[:tables]}` instead"
  when "groups"
    args.shift
    opts[:groups] = args.shift
    deprecated "Use `pgsync #{opts[:groups]}` instead"
  end

  if opts[:where]
    opts[:sql] ||= String.new
    opts[:sql] << " WHERE #{opts[:where]}"
    deprecated "Use `\"WHERE #{opts[:where]}\"` instead"
  end

  if opts[:limit]
    opts[:sql] ||= String.new
    opts[:sql] << " LIMIT #{opts[:limit]}"
    deprecated "Use `\"LIMIT #{opts[:limit]}\"` instead"
  end
end