Bug description Using migrations from version 2.14, I updated an enum to add a few more values. That generated the following migration. -- AlterEnum ALTER TYPE "account_type_enum" ADD VALUE 'Giving'; ALTER TYPE "account_type_enum" ADD VA...
[ IF NOT EXISTS ] new_enum_value [ { BEFORE | AFTER } neighbor_enum_value ] ALTER TYPE name RENAME VALUE existing_enum_value TO new_enum_value ALTER TYPE name SET ( property = value [, ... ] ) 这里 action 是以下之一: ADD ATTRIBUTE attribute_name data_type [ COLLATE collation ] ...
ALTER TYPE email SET SCHEMA customers; 给一个数据类型增加一个新的属性: ALTER TYPE compfoo ADD ATTRIBUTE f3 int; 给一个枚举类型增加一个指定位置的新值: ALTER TYPE colors ADD VALUE 'orange' AFTER 'red';兼容性 增加或删除属性是SQL标准,其他选项都是PostgreSQL的扩展。
new_enum_value 这里action 是以下之一: ADD ATTRIBUTE attribute_name data_type [ COLLATE collation ] [ CASCADE | RESTRICT ] DROP ATTRIBUTE [ IF EXISTS ] attribute_name [ CASCADE | RESTRICT ] ALTER ATTRIBUTE attribute_name [ SET DATA ] TYPE data_type [ COLLATE collation ] [ CASCADE | ...
It works well when all you want is to remove auto_increment or change ENUM values. When it comes to changes that really require table to be rebuilt – adding/dropping columns or indexes, changing data type, converting data to different character set – MySQL master-master replication especially...
to add more ENUM values shouldn’t require one provided the layout of the rows won’t change. Of course if you know this, thenit’s possible to hack the change by doing the ALTER to a similar, empty table, then copying the .frm file (this requires the table to be closed with a ...
not on a table/column level. PostgreSQL doesn't have a CONVER TO CHARACTER SET option. Conversion is done with a dump/restore cycle. --- test1=# create type test3 as enum ('Café','Wroclaw'); CREATE TYPE test1=# \dT+ test3 List of data types Schema | Name | Internal name | Siz...