pronounsfu/scripts/migrate/004_field_arrays.sql

62 lines
1.9 KiB
MySQL
Raw Normal View History

2023-01-04 13:41:29 -08:00
-- 2023-01-03: change names, pronouns, and fields to be columns instead of separate tables
2023-08-15 18:30:34 -07:00
-- +migrate Up
2023-01-04 13:41:29 -08:00
create type field_entry as (
value text,
status int
);
create type pronoun_entry as (
value text,
display_value text,
status int
);
alter table users add column names field_entry[];
alter table users add column pronouns pronoun_entry[];
alter table members add column names field_entry[];
alter table members add column pronouns pronoun_entry[];
alter table user_fields add column entries field_entry[];
alter table member_fields add column entries field_entry[];
alter table user_fields drop column favourite;
alter table user_fields drop column okay;
alter table user_fields drop column jokingly;
alter table user_fields drop column friends_only;
alter table user_fields drop column avoid;
alter table member_fields drop column favourite;
alter table member_fields drop column okay;
alter table member_fields drop column jokingly;
alter table member_fields drop column friends_only;
alter table member_fields drop column avoid;
2023-08-15 18:30:34 -07:00
-- +migrate Down
alter table user_fields add column favourite text[];
alter table user_fields add column okay text[];
alter table user_fields add column jokingly text[];
alter table user_fields add column friends_only text[];
alter table user_fields add column avoid text[];
alter table member_fields add column favourite text[];
alter table member_fields add column okay text[];
alter table member_fields add column jokingly text[];
alter table member_fields add column friends_only text[];
alter table member_fields add column avoid text[];
alter table users drop column names;
alter table users drop column pronouns;
alter table members drop column names;
alter table members drop column pronouns;
alter table user_fields drop column entries;
alter table member_fields drop column entries;
drop type field_entry;
drop type pronoun_entry;