- def alter_column_nwr_enum (table_name, column)
- response = select_one("select count(*) as count from pg_type where typname = 'nwr_enum'")
- if response['count'] == "0" #yep, as a string
- execute "create type nwr_enum as ENUM ('Node', 'Way', 'Relation')"
- end
- execute "alter table #{table_name} drop #{column}"
- execute "alter table #{table_name} add #{column} nwr_enum"
+ def enumerations
+ @enumerations ||= Hash.new
+ end
+
+ def create_enumeration (enumeration_name, values)
+ enumerations[enumeration_name] = values
+ execute "create type #{enumeration_name} as enum ('#{values.join '\',\''}')"
+ end
+
+ def drop_enumeration (enumeration_name)
+ execute "drop type #{enumeration_name}"
+ enumerations.delete(enumeration_name)