-- Write your migrate up statements here -- Create new table to store entire fullresult create table wynn.items_fullresult ( hash text not null primary key, data jsonb not null, timestamp timestamptz not null default now() ); create index items_fullresult_timestamp on wynn.items_fullresult (timestamp); -- Drop the old items table drop table if exists wynn.items; -- Remove the old hash tracking delete from meta.hashes where key = 'wynn.items'; ---- create above / drop below ---- -- Recreate the old items table create table wynn.items ( name text not null primary key, display_name text not null, type text not null, hash text not null, data jsonb not null ); -- Restore hash tracking insert into meta.hashes (key, value) select 'wynn.items', hash from wynn.items_fullresult order by timestamp desc limit 1 on conflict do nothing; -- Drop the new table drop table if exists wynn.items_fullresult; -- Write your migrate down statements here. If this migration is irreversible -- Then delete the separator line above.