Skip to content

Latest commit

 

History

History
63 lines (42 loc) · 2.42 KB

tables.md

File metadata and controls

63 lines (42 loc) · 2.42 KB

Table Operations

pgm.createTable( tablename, columns, options )

Create a new table - postgres docs

Arguments:

  • tablename [Name] - name for the new table
  • columns [object] - column names / options -- see column definitions section
  • options [object] - table options (optional)
    • temporary [bool] - default false
    • ifNotExists [bool] - default false
    • inherits [Name] - table(s) to inherit from
    • constraints [object] - table constraints see add constraint
    • like either:
      • [Name] - table(s) to inherit from
      • or [object]
        • table [Name] - table(s) to inherit from
        • options [object] - like options (optional)
          • including [string or array of strings] - 'COMMENTS', 'CONSTRAINTS', 'DEFAULTS', 'IDENTITY', 'INDEXES', 'STATISTICS', 'STORAGE', 'ALL'
          • excluding [string or array of strings] - 'COMMENTS', 'CONSTRAINTS', 'DEFAULTS', 'IDENTITY', 'INDEXES', 'STATISTICS', 'STORAGE', 'ALL'
    • comment [string] - adds comment on table

Reverse Operation: dropTable


pgm.dropTable( tablename, options )

Drop existing table - postgres docs

Arguments:

  • tablename [Name] - name of the table to drop
  • options [object] - options:
    • ifExists [boolean] - drops table only if it exists
    • cascade [boolean] - drops also dependent objects

pgm.renameTable( tablename, new_tablename )

Rename a table - postgres docs

Arguments:

  • tablename [Name] - name of the table to rename
  • new_table [Name] - new name of the table

Reverse Operation: same operation in opposite direction


pgm.alterTable( tablename, options )

Alter existing table - postgres docs

Arguments:

  • tablename [Name] - name of the table to alter
  • options [object] - options:
    • levelSecurity [string] - DISABLE, ENABLE, FORCE, or NO FORCE