Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { SteamItem } = require("./models");
- const run = async () => {
- const lastOne = await SteamItem.findAll({
- limit: 1,
- order: [["id", "DESC"]],
- });
- console.log(lastOne[0].id); // 13369
- const data = [
- {
- appId: 730,
- marketHashName: "AWP | The Prince (Well-Worn)", // existed
- },
- {
- appId: 730,
- marketHashName: "Autograph Capsule | FaZe Clan | Atlanta 2017", // existed
- },
- {
- appId: 730,
- marketHashName: "new",
- },
- {
- appId: 730,
- marketHashName: "Autograph Capsule | Team EnVyUs | Atlanta 2017", // existed
- },
- {
- appId: 730,
- marketHashName: "Sticker | G2 Esports (Foil) | Cluj-Napoca 2015", // existed
- },
- ];
- const res = await SteamItem.bulkCreate(data, {
- ignoreDuplicates: true,
- });
- // id of new 13372
- const res2 = await SteamItem.bulkCreate(
- [
- {
- appId: 730,
- marketHashName: "newnew",
- },
- ],
- {
- ignoreDuplicates: true,
- }
- );
- // id of newnew 13375
- };
- run();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement