File tree 2 files changed +49
-0
lines changed
2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ const Chain = require('../../chain');
8
8
const StateTravel = require ( '../../methods/v2/statetravel' ) ;
9
9
const Migrate = require ( '../../methods/v2/migrate' ) ;
10
10
const TranslateState = require ( '../../methods/v2/translatestate' ) ;
11
+ const AddConventions = require ( '../../methods/v2/conventions' ) ;
11
12
12
13
const execUnit = {
13
14
_extend : ( context , type ) => {
@@ -28,6 +29,7 @@ const execUnit = {
28
29
up : async function ( context , driver , file ) {
29
30
const _file = file . get ( ) ;
30
31
const chain = new Chain ( context . _driver , file , driver , context . internals ) ;
32
+ chain . addChain ( AddConventions ) ;
31
33
chain . addChain ( Learn ) ;
32
34
chain . addChain ( StateTravel ) ;
33
35
chain . addChain ( Migrate ) ;
Original file line number Diff line number Diff line change
1
+ const Shadow = require ( '../../driver/shadow' ) ;
2
+
3
+ class AddConventions {
4
+ constructor ( internals , file , driver ) {
5
+ this . file = file ;
6
+ this . internals = internals ;
7
+ this . driver = driver ;
8
+ this . _counter = 0 ;
9
+ }
10
+
11
+ createTable ( t , d ) {
12
+ d [ '__dbmigrate__flag' ] = {
13
+ type : 'string'
14
+ } ;
15
+
16
+ return Promise . resolve ( ) ;
17
+ }
18
+
19
+ createCollection ( ...args ) {
20
+ return this . createTable . apply ( this , args ) ;
21
+ }
22
+ }
23
+
24
+ const noAction = prop => {
25
+ return function ( ) {
26
+ return Promise . resolve ( ) ;
27
+ } ;
28
+ } ;
29
+
30
+ module . exports = {
31
+ getInterface : ( context , file , driver , internals ) => {
32
+ if ( context . conventions ) {
33
+ const st = new AddConventions ( internals , file , context ) ;
34
+ return Shadow . overshadow (
35
+ driver ,
36
+ Object . assign ( st , context . conventions ) ,
37
+ noAction
38
+ ) ;
39
+ }
40
+
41
+ return Shadow . overshadow (
42
+ driver ,
43
+ new AddConventions ( internals , file , context ) ,
44
+ noAction
45
+ ) ;
46
+ }
47
+ } ;
You can’t perform that action at this time.
0 commit comments