postgresql ddl说明

检查隔离级别:

  show transaction_isolation;

删除默认值:

  alter table ${table_name} alter column ${column_name} drop default;

添加默认值:

  alter table ${table_name} alter column ${column_name} set default ${default_value};

创建索引:

  create index ${index_name} on ${table_name} (${column_list});

删除索引:

  drop index if exists ${index_name};

添加字段:

  alter table ${table_name} add column ${column_name} ${type};

  comment on ${table_name}.${column_name} is '${remark}';

删除字段:

  alter table ${table_name} drop column if exists ${column_name};

修改主键:

  alter table ${table_name} drop constraint ${pk_name};

  alter table ${table_name} add constraint ${pk_name} key(${column_list});

 

posted on 2019-03-29 14:27  十字街~  阅读(974)  评论(0编辑  收藏  举报