-- PW-1608 addresses: Split name into first name and last name

BEGIN;
    ALTER TABLE addresses
        ADD COLUMN first_name VARCHAR,
        ADD COLUMN last_name VARCHAR;

    UPDATE addresses SET
        first_name = left(name, strpos(name, ' ')),
        last_name = right(name, -strpos(name, ' '));

    ALTER TABLE addresses
        DROP COLUMN name;
COMMIT;
