-- Reset sequences for tables touched by login-only seed (PostgreSQL)

SELECT setval(
    pg_get_serial_sequence('users', 'id'),
    COALESCE((SELECT MAX(id) FROM users), 1),
    true
);

SELECT setval(
    pg_get_serial_sequence('team_members', 'id'),
    COALESCE((SELECT MAX(id) FROM team_members), 1),
    true
);

SELECT setval(
    pg_get_serial_sequence('refresh_tokens', 'id'),
    COALESCE((SELECT MAX(id) FROM refresh_tokens), 1),
    true
);

SELECT setval(
    pg_get_serial_sequence('otps', 'id'),
    COALESCE((SELECT MAX(id) FROM otps), 1),
    true
);
