Skip to content

Import data

Stas Dmytryshyn edited this page Jul 12, 2025 · 1 revision

Categories

Export from FF

select json_agg(name order by name) as names
from (select distinct name
      from (select name
            from categories
            where deleted_at is null) as cntt) as distinct_names

Import to Go Money

DO $$
DECLARE
    category_names TEXT[] := ARRAY[
        'Bank Fees', 'Bills', ...<put output from export section>
    ];
    category_name TEXT;
BEGIN
    FOREACH category_name IN ARRAY category_names
    LOOP
        INSERT INTO categories (name, created_at)
        SELECT category_name, now()
        WHERE NOT EXISTS (
            SELECT 1 FROM categories WHERE name = category_name AND deleted_at IS NULL
        );
    END LOOP;
END $$;
Clone this wiki locally