diff --git a/server.js b/server.js index 80c6266..3c4d41b 100644 --- a/server.js +++ b/server.js @@ -85,7 +85,7 @@ app.post('/image', uploadMulter.single('image'), async (req, res) => { const currentDate = new Date().toISOString(); const localFile = req.file.path.startsWith(uploadDir + '/') ? req.file.path.substring(uploadDir.length + 1) : req.file.path; const finalUrl = `https://${bucketName}.s3.amazonaws.com/${fileName}`; - await db.run('INSERT INTO image (date, did, local_file, size, aws_file, url) VALUES (?, ?, ?, ?, ?, ?)', [ + await db.run('INSERT INTO image (time, did, local_file, size, final_file, url) VALUES (?, ?, ?, ?, ?, ?)', [ currentDate, issuerDid, localFile, diff --git a/sql/migrations/V1__Create_image_table.sql b/sql/migrations/V1__Create_image_table.sql index fe420ec..fdf5470 100644 --- a/sql/migrations/V1__Create_image_table.sql +++ b/sql/migrations/V1__Create_image_table.sql @@ -1,8 +1,13 @@ + CREATE TABLE image ( - date TEXT NOT NULL, + time TEXT NOT NULL, did TEXT NOT NULL, local_file TEXT NOT NULL, size INTEGER NOT NULL, - aws_file TEXT NOT NULL, + final_file TEXT NOT NULL, url TEXT NOT NULL ); + +CREATE INDEX image_date ON image(time); +CREATE INDEX image_did ON image(did); +CREATE INDEX image_finalFile ON image(final_file);