Insert to Database in Custom Module

Hey all,

I’m creating a custom module to insert records to the database (I’m not using the standard db modules in SC because I have some very specific checks/matches, redundant record deletions etc…) and I was wondering if the following will actually insert. Currently, the module runs successfully, however, it does not insert or update the database.

// Insert new family charge
    await db.raw(`
        INSERT INTO
            charges_family (
                uuid, family_uuid, total, title, reference, description, chargeFor_monthly, due_date, chargeType, basetotal, discounttotal, chargeDate, createdby, created
            )
        VALUES(
            ${uuid}, ${d.family_uuid}, ${d.totals.enrolsgrand}, ${title}, ${reference}, ${description}, ${d.monthlycharge}, ${due_date}, 'tuition', ${d.totals.baseRate}, ${d.totals.disctotal}, ${charge_date}, ${user}, ${created}
        )
    `);

I do have the relevant connection settings:
image

Thanks in advance for any guidance.

Cheers
Michael

Community Page
Last updated: