db-migrate 1.0.0-beta.9 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/te.js DELETED
@@ -1,70 +0,0 @@
1
- exports.migrate = async (db, opt) => {
2
- const { util } = opt.dbm;
3
-
4
- await db.insert(
5
- 'test',
6
- // can recieve object or array of same structured objs
7
- util.insertObj([
8
- { column1: '1', column2: '2' },
9
- { column1: '1', column2: '3' },
10
- { column1: '2', column2: '4' }
11
- ])
12
- );
13
- /**
14
- * For efficiency insertObj shouldn't be used on big operations
15
- * The previous command essentially expands to:
16
- */
17
- await db.insert('test', {
18
- columns: ['column1', 'column2'],
19
- data: ['1', '2', '1', '3', '2', '4']
20
- });
21
-
22
- /**
23
- * The streaming interface can be accessed by passing a config object
24
- * with the predefinition of the incoming data and the stream to consume
25
- * from.
26
- */
27
- const streamConfig = {
28
- columns: ['column1', 'column2'],
29
- stream: myDataStream
30
- };
31
- await db.insert.stream('test', streamConfig);
32
-
33
- /**
34
- * Streaming can be used with helper functions such as structured readers.
35
- */
36
- await db.insert.stream(
37
- 'test',
38
- util.readStructured('./data.csv', { delimiter: ';' })
39
- );
40
-
41
- /**
42
- * And of course also read from other tables data.
43
- */
44
- await db.insert.from('test', 'readme', {
45
- map: {
46
- source1: 'column1',
47
- source2: 'column2'
48
- },
49
- search: 'ventilation NOT NULL'
50
- });
51
-
52
- /**
53
- * Instead of search as a short hand, the get property
54
- * will give access to get directly.
55
- */
56
- await db.insert.from('test', 'readme', {
57
- map: {
58
- source1: 'column1',
59
- source2: 'column2'
60
- },
61
- get: {
62
- /* ... */
63
- }
64
- });
65
- };
66
-
67
- exports._meta = {
68
- version: 2,
69
- DML: true
70
- };