Making order_id (BTCPay invoice id) unique in the database.
This commit is contained in:
parent
55646b5732
commit
4c203631db
@ -105,7 +105,7 @@ class Donations {
|
|||||||
private async $addDonationToDatabase(btcPaid: number, handle: string, orderId: string, imageUrl: string): Promise<void> {
|
private async $addDonationToDatabase(btcPaid: number, handle: string, orderId: string, imageUrl: string): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const connection = await DB.pool.getConnection();
|
const connection = await DB.pool.getConnection();
|
||||||
const query = `INSERT INTO donations(added, amount, handle, order_id, imageUrl) VALUES (NOW(), ?, ?, ?, ?)`;
|
const query = `INSERT IGNORE INTO donations(added, amount, handle, order_id, imageUrl) VALUES (NOW(), ?, ?, ?, ?)`;
|
||||||
const params: (string | number)[] = [
|
const params: (string | number)[] = [
|
||||||
btcPaid,
|
btcPaid,
|
||||||
handle,
|
handle,
|
||||||
|
@ -100,3 +100,5 @@ ALTER TABLE `donations`
|
|||||||
|
|
||||||
ALTER TABLE `donations`
|
ALTER TABLE `donations`
|
||||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||||
|
|
||||||
|
ALTER TABLE `donations` ADD UNIQUE(`order_id`);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user