Method: PgQuery::Deparse::AlterTable.commands

Defined in:
lib/pg_query/deparse/alter_table.rb

.commands(node) ⇒ Object

Returns a list of strings of length one or length two. The first string will be placed before the column name and the second, if present, will be placed after.

If node is the integer 4 (AT_DropNotNull), then return value of this method will be:

['ALTER COLUMN', 'DROP NOT NULL']

Which will be composed into the SQL as:

ALTER COLUMN {column_name} DROP NOT NULL


17
18
19
20
# File 'lib/pg_query/deparse/alter_table.rb', line 17

def self.commands(node)
  action = ALTER_TABLE_TYPES_MAPPING[node['subtype']] || raise(format("Can't deparse: %s", node.inspect))
  PgQuery::Deparse.instance_exec(node, &action)
end