G4brym/workers-qb

CURRENT_TIMESTAMP is being stored as string rather timestamp

subhendukundu opened this issue · 4 comments

const tableData = {
      id,
      name,
      user_id: user.id,
      created_at: "CURRENT_TIMESTAMP",
      updated_at: "CURRENT_TIMESTAMP",
};

This is being stored as string for created_at and updated_at.

Hey @subhendukundu you can now use the Raw class to send raw sql to the query builder checkout the docs here
https://workers-qb.massadas.com/advanced-queries/raw-sql/

import { Raw } from 'workers-qb'

Module '"workers-qb"' has no exported member 'Raw'.

My bad, can you update to the latest version (v0.1.5) and try again

Hey! It was working correctly on local. Now I have published it on production, Raw. Do you have any api running using new Raw?

await db.insert({
      tableName: "posts",
      data: {
        id: generateUniqueIdWithPrefix(),
        user_id: id,
        created_at: new Raw("CURRENT_TIMESTAMP"), // Removed this one, and working.
      },
});