Skip to content

Instantly share code, notes, and snippets.

@Wonder2210
Created October 12, 2020 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Wonder2210/83eeff9e203aec814cfb1533eb0f0637 to your computer and use it in GitHub Desktop.
Save Wonder2210/83eeff9e203aec814cfb1533eb0f0637 to your computer and use it in GitHub Desktop.
exports.seed = function (knex) {
// Deletes ALL existing entries
return knex("table name")
.del()
.then(function () {
// Inserts seed entries
return knex("table name").insert([
// here will be your data with the fields your database needs
// for example { id: 1, full_name: "luis", country_code: 58 },
,
]);
})
.then(() => {
return knex("table name")
.del()
.then(function () {
// Inserts seed entries
return knex("table name").insert([
// here will be your data with the fields your database needs
// for example { id: 1, full_name: "luis", country_code: 58 },
,
]);
});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment