add some indexes and change some column names
This commit is contained in:
@@ -85,7 +85,7 @@ app.post('/image', uploadMulter.single('image'), async (req, res) => {
|
|||||||
const currentDate = new Date().toISOString();
|
const currentDate = new Date().toISOString();
|
||||||
const localFile = req.file.path.startsWith(uploadDir + '/') ? req.file.path.substring(uploadDir.length + 1) : req.file.path;
|
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}`;
|
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,
|
currentDate,
|
||||||
issuerDid,
|
issuerDid,
|
||||||
localFile,
|
localFile,
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
|
|
||||||
CREATE TABLE image (
|
CREATE TABLE image (
|
||||||
date TEXT NOT NULL,
|
time TEXT NOT NULL,
|
||||||
did TEXT NOT NULL,
|
did TEXT NOT NULL,
|
||||||
local_file TEXT NOT NULL,
|
local_file TEXT NOT NULL,
|
||||||
size INTEGER NOT NULL,
|
size INTEGER NOT NULL,
|
||||||
aws_file TEXT NOT NULL,
|
final_file TEXT NOT NULL,
|
||||||
url 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);
|
||||||
|
|||||||
Reference in New Issue
Block a user