Skip to content

Instantly share code, notes, and snippets.

@Wonder2210
Created October 12, 2020 03:34
Show Gist options
  • Save Wonder2210/e895fa294799a3ee3bf1be87d74f1a80 to your computer and use it in GitHub Desktop.
Save Wonder2210/e895fa294799a3ee3bf1be87d74f1a80 to your computer and use it in GitHub Desktop.
exports.seed = function (knex) {
// Deletes ALL existing entries
return knex("users")
.del()
.then(function () {
// Inserts seed entries
return knex("users").insert([
{ id: 1, full_name: "luis", country_code: 58 },
{ id: 2, full_name: "jose", country_code: 59 },
{ id: 3, full_name: "raul", country_code: 39 },
]);
})
.then(() => {
return knex("pets")
.del()
.then(function () {
// Inserts seed entries
return knex("pets").insert([
{ id: 1, name: "spot", owner_id: 1, specie: "MAMMALS" },
{ id: 2, name: "chief", owner_id: 2, specie: "MAMMALS" },
{ id: 3, name: "king", owner_id: 3, specie: "MAMMALS" },
]);
});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment