You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
481 B
17 lines
481 B
export const seed = async knex => {
|
|
// 检查表是否存在
|
|
const hasUsersTable = await knex.schema.hasTable('users');
|
|
|
|
if (!hasUsersTable) {
|
|
console.error("表 users 不存在,请先执行迁移")
|
|
return
|
|
}
|
|
// Deletes ALL existing entries
|
|
await knex("users").del()
|
|
|
|
// Inserts seed entries
|
|
// await knex("users").insert([
|
|
// { username: "Alice", email: "alice@example.com" },
|
|
// { username: "Bob", email: "bob@example.com" },
|
|
// ])
|
|
}
|
|
|