@cfxlabsinc/b2b-services
    Preparing search index...

    Variable manualBankAccountViewConst

    manualBankAccountView: PgViewWithSelection<
        "manual_bank_account_bank_account_view",
        false,
        {
            accountNumber: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgTextBuilder<[string, ...string[]]>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            bankId: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgTextBuilder<[string, ...string[]]>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            bankName: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgTextBuilder<[string, ...string[]]>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            createdAt: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                SetNotNull<PgTimestampBuilder>,
                {
                    data: Date;
                    dataType: "object date";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: true;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            credits: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgNumericBuilder,
                {
                    data: string;
                    dataType: "string numeric";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            creditsExInternal: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgNumericBuilder,
                {
                    data: string;
                    dataType: "string numeric";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            currency: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                SetNotNull<PgTextBuilder<[string, ...string[]]>>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: true;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            customerId: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgTextBuilder<[string, ...string[]]>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            customerName: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgTextBuilder<[string, ...string[]]>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            debits: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgNumericBuilder,
                {
                    data: string;
                    dataType: "string numeric";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            debitsExInternal: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgNumericBuilder,
                {
                    data: string;
                    dataType: "string numeric";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            deletedAt: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgTimestampBuilder,
                {
                    data: Date;
                    dataType: "object date";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            entityId: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgTextBuilder<[string, ...string[]]>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            entityName: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgTextBuilder<[string, ...string[]]>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            entityType: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgTextBuilder<[string, ...string[]]>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            firstPostedAt: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgTimestampBuilder,
                {
                    data: Date;
                    dataType: "object date";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            id: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                SetNotNull<PgTextBuilder<[string, ...string[]]>>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: true;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            impliedBalance: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgNumericBuilder,
                {
                    data: string;
                    dataType: "string numeric";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            impliedBalanceExInternal: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgNumericBuilder,
                {
                    data: string;
                    dataType: "string numeric";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            key: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                SetNotNull<PgTextBuilder<[string, ...string[]]>>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: true;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            keyable: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                SetNotNull<PgBooleanBuilder>,
                {
                    data: boolean;
                    dataType: "boolean";
                    driverParam: boolean;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: true;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            lastPostedAt: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgTimestampBuilder,
                {
                    data: Date;
                    dataType: "object date";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            ledgerAccountId: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgTextBuilder<[string, ...string[]]>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            memo: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgTextBuilder<[string, ...string[]]>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            name: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgTextBuilder<[string, ...string[]]>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            parentKey: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgTextBuilder<[string, ...string[]]>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            provider: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgTextBuilder<[string, ...string[]]>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            providerAccountId: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgTextBuilder<[string, ...string[]]>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            routingNumber: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgTextBuilder<[string, ...string[]]>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            source: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                SetNotNull<PgTextBuilder<[string, ...string[]]>>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: true;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            sourceRecordId: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgTextBuilder<[string, ...string[]]>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            status: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                SetNotNull<PgTextBuilder<[string, ...string[]]>>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: true;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            transactionCount: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgIntegerBuilder,
                {
                    data: number;
                    dataType: "number int32";
                    driverParam: string
                    | number;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            type: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                PgTextBuilder<[string, ...string[]]>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
            updatedAt: PgBuildColumn<
                "manual_bank_account_bank_account_view",
                SetNotNull<PgTimestampBuilder>,
                {
                    data: Date;
                    dataType: "object date";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: true;
                    tableName: "manual_bank_account_bank_account_view";
                },
            >;
        },
    > = ...

    The MANUAL arm of bankAccountView — accounts an operator registered, with balances implied from the bank_transaction feed.

    Anti-joined against victor_account and virtual_account because a manual registration does NOT outrank the typed tables: those are systems of record maintained by the provider integrations, and a hand-typed row that shadowed one would present an operator's transcription as authoritative over Victor's own record of the account. The inferred arms are the opposite case — they assert nothing a human confirmed, so a human confirmation wins, which is why bankInstructionBankAccountView and observedBankAccountView anti-join the manual TABLE rather than the reverse. See § 4.7.

    One consequence of anti-joining the table rather than this view: an account registered here AND present in victor_account drops from this arm while still suppressing its BANK_INSTRUCTION row, so it surfaces exactly once, as VICTOR_ACCOUNT. Anti-joining the view instead would resurrect the inferred row and produce two.

    bank_name prefers the joined partner bank and falls back to the free-text column, which is the only name a non-partner counterparty bank has.

    The balance lateral correlates on the account alone, never on this arm's memo, and that is deliberate rather than an oversight. A memo here is an operator's label for a slice of a shared account — not the metcap FFC key that data -> 'methodData' ->> 'ffcMemo' carries — so narrowing by it would return zero for every registration that has one. The memo still participates in key, so two memo'd registrations of one account stay distinct rows that report the same account-level balance.

    dbmate owns the DDL: the body below is mirrored by 20260814200000_bank_account_view.sql.