mirror of
https://github.com/Alvin-Zilverstand/school.git
synced 2026-12-03 11:31:20 +01:00
replace png with webp
This commit is contained in:
1 parent
9acbc04ae1
commit
470608f6fd
4044 files changed
+53
No files matched your search
@@ -0,0 +1,29 @@
|
||||
const mysql = require("mysql");
|
||||
|
||||
const connection = mysql.createConnection({
|
||||
host: "localhost", // Ensure this points to your local database
|
||||
user: "root",
|
||||
password: "",
|
||||
database: "pokedex1",
|
||||
port: 3306,
|
||||
});
|
||||
|
||||
connection.connect((err) => {
|
||||
if (err) {
|
||||
console.error("Error connecting to the database:", err.message);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log("Connected to the local database.");
|
||||
|
||||
const query = "UPDATE pokemon SET image_url = REPLACE(image_url, '.png', '.webp')";
|
||||
console.log("Executing query:", query);
|
||||
|
||||
connection.query(query, (error, results) => {
|
||||
if (error) {
|
||||
console.error("Error updating image URLs:", error.message);
|
||||
} else {
|
||||
console.log("Image URLs updated successfully. Rows affected:", results.affectedRows);
|
||||
}
|
||||
connection.end();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user