created_at -> timestamp

This commit is contained in:
dylan 2024-03-31 17:49:50 -07:00
parent 008e5777c5
commit a3b07d6028
2 changed files with 4 additions and 2 deletions

View File

@ -0,0 +1,2 @@
ALTER TABLE releases DROP COLUMN created_at;
ALTER TABLE releases ADD created_at timestamp;

View File

@ -76,13 +76,13 @@ export const getRelease = async (where: {
export const insertRelease = async (props: {manifest: PicobookManifest, carts: {name: string; rom: number[]}[]}) => { export const insertRelease = async (props: {manifest: PicobookManifest, carts: {name: string; rom: number[]}[]}) => {
const {manifest, carts} = props; const {manifest, carts} = props;
console.log('carts', JSON.stringify(carts)); // console.log('carts', JSON.stringify(carts));
const {id: slug, author, repo, version} = manifest; const {id: slug, author, repo, version} = manifest;
const id = uuidv4(); const id = uuidv4();
const now = new Date(); const now = new Date();
await db.query(sql` await db.query(sql`
INSERT INTO releases (id, slug, repo, version, author, carts, manifest, created_at) INSERT INTO releases (id, slug, repo, version, author, carts, manifest, created_at)
VALUES (${id}, ${slug}, ${repo}, ${version}, ${author}, ${JSON.stringify(carts)}, ${manifest}, ${now}) VALUES (${id}, ${slug}, ${repo}, ${version}, ${author}, ${carts}, ${manifest}, ${now})
`); `);
return id; return id;
} }