migration to postgresql
This commit is contained in:
@ -50,7 +50,7 @@ export default async bot => {
|
||||
return e.reply(`repost motherf0cker (link): ${cfg.main.url}/${q_repost[0].id}`);
|
||||
|
||||
// generate uuid
|
||||
const uuid = (await sql.select(sql.raw("left(uuid(), 8) as uuid")))[0].uuid;
|
||||
const uuid = (await sql.select(sql.raw("gen_random_uuid() as uuid")))[0].uuid.substring(0, 8);
|
||||
|
||||
const maxfilesize = (getLevel(e.user).level > 50 ? cfg.main.maxfilesize * 2.5 : cfg.main.maxfilesize) / 1024;
|
||||
|
||||
@ -115,7 +115,7 @@ export default async bot => {
|
||||
await fs.promises.copyFile(`./tmp/${filename}`, `./public/b/${filename}`);
|
||||
await fs.promises.unlink(`./tmp/${filename}`).catch(_=>{});
|
||||
|
||||
const insertq = (await sql("items").insert({
|
||||
await sql("items").insert({
|
||||
src: e.photo ? "" : link,
|
||||
dest: filename,
|
||||
mime: mime,
|
||||
@ -126,7 +126,8 @@ export default async bot => {
|
||||
usernetwork: e.network,
|
||||
stamp: ~~(new Date() / 1000),
|
||||
active: 1
|
||||
}))[0];
|
||||
});
|
||||
const insertq = (await sql('items').where('dest', filename).limit(1))[0].id;
|
||||
|
||||
// generate thumbnail
|
||||
try {
|
||||
|
Reference in New Issue
Block a user