Logo
Explore Help
Register Sign In
yujunjun/knex
1
0
Fork 0
You've already forked knex
mirror of https://github.com/knex/knex.git synced 2025-07-19 15:01:45 +00:00
Code Issues Packages Projects Releases Wiki Activity
knex/lib/seed/stub/ts.stub

15 lines
440 B
Plaintext
Raw Normal View History

Support knexfile, migration and seeds in TypeScript (#1769) * Support knexfile, migration and seeds in TypeScript * Look for .ts seed files * Fix linter warning for max-len * Enforce migration scripts to return a promise * Remove Promise.all example from stub
2016-12-01 14:02:21 +05:30
import * as Knex from "knex";
Make TS stubs modern (#3080)
2019-03-05 16:37:43 +02:00
export async function seed(knex: Knex): Promise<any> {
Support knexfile, migration and seeds in TypeScript (#1769) * Support knexfile, migration and seeds in TypeScript * Look for .ts seed files * Fix linter warning for max-len * Enforce migration scripts to return a promise * Remove Promise.all example from stub
2016-12-01 14:02:21 +05:30
// Deletes ALL existing entries
return knex("table_name").del()
Make TS stubs modern (#3080)
2019-03-05 16:37:43 +02:00
.then(() => {
Support knexfile, migration and seeds in TypeScript (#1769) * Support knexfile, migration and seeds in TypeScript * Look for .ts seed files * Fix linter warning for max-len * Enforce migration scripts to return a promise * Remove Promise.all example from stub
2016-12-01 14:02:21 +05:30
// Inserts seed entries
return knex("table_name").insert([
{ id: 1, colName: "rowValue1" },
{ id: 2, colName: "rowValue2" },
{ id: 3, colName: "rowValue3" }
]);
});
};
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.5 Page: 1542ms Template: 8ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API