fix(all): TRUE multicloud.
This commit is contained in:
		
							parent
							
								
									a7be4850b7
								
							
						
					
					
						commit
						cc22f3963d
					
				
					 1 changed files with 63 additions and 60 deletions
				
			
		| 
						 | 
					@ -289,27 +289,10 @@ export class GBVMService extends GBService {
 | 
				
			||||||
      if (Fs.existsSync(filePath)) {
 | 
					      if (Fs.existsSync(filePath)) {
 | 
				
			||||||
        connections = JSON.parse(Fs.readFileSync(filePath, 'utf8'));
 | 
					        connections = JSON.parse(Fs.readFileSync(filePath, 'utf8'));
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      const shouldSync = min.core.getParam<boolean>(min.instance, 'Synchronize Database', false);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      tableDef.forEach(async t => {
 | 
					      connections.forEach(async con => {
 | 
				
			||||||
        const tableName = t.name.trim();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Determines autorelationship.
 | 
					        const connectionName = con['storageDriver']
 | 
				
			||||||
        Object.keys(t.fields).forEach(key => {
 | 
					 | 
				
			||||||
          let obj = t.fields[key];
 | 
					 | 
				
			||||||
          obj.type = getTypeBasedOnCondition(obj.type, obj.size);
 | 
					 | 
				
			||||||
          if (obj.type.key === 'TABLE') {
 | 
					 | 
				
			||||||
            obj.type.key = 'BIGINT';
 | 
					 | 
				
			||||||
            associations.push({ from: tableName, to: obj.type.name });
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // Cutom connection for TABLE.
 | 
					 | 
				
			||||||
        const connectionName = t.connection;
 | 
					 | 
				
			||||||
        let con;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (connectionName && connections) {
 | 
					 | 
				
			||||||
          con = connections.filter(p => p.name === connectionName)[0];
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const dialect = con['storageDriver'];
 | 
					        const dialect = con['storageDriver'];
 | 
				
			||||||
        const host = con['storageServer'];
 | 
					        const host = con['storageServer'];
 | 
				
			||||||
| 
						 | 
					@ -367,7 +350,27 @@ export class GBVMService extends GBService {
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      const shouldSync = min.core.getParam<boolean>(min.instance, 'Synchronize Database', false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      tableDef.forEach(async t => {
 | 
				
			||||||
 | 
					        const tableName = t.name.trim();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Determines autorelationship.
 | 
				
			||||||
 | 
					        Object.keys(t.fields).forEach(key => {
 | 
				
			||||||
 | 
					          let obj = t.fields[key];
 | 
				
			||||||
 | 
					          obj.type = getTypeBasedOnCondition(obj.type, obj.size);
 | 
				
			||||||
 | 
					          if (obj.type.key === 'TABLE') {
 | 
				
			||||||
 | 
					            obj.type.key = 'BIGINT';
 | 
				
			||||||
 | 
					            associations.push({ from: tableName, to: obj.type.name });
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Cutom connection for TABLE.
 | 
				
			||||||
 | 
					        const connectionName = t.connection;
 | 
				
			||||||
 | 
					        let con;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!con) {
 | 
					        if (!con) {
 | 
				
			||||||
          throw new Error(`Invalid connection specified: ${connectionName}.`);
 | 
					          throw new Error(`Invalid connection specified: ${connectionName}.`);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue