Add an implicit table to the given application and return its new TableDefinition.
186448
private TableDefinition addAutoTable(ApplicationDefinition appDef, String tableName) {
        m_logger.debug("Adding implicit table '{}' to application '{}'", tableName, appDef.getAppName());
        Tenant tenant = Tenant.getTenant(appDef);
        TableDefinition tableDef = new TableDefinition(appDef);
        tableDef.setTableName(tableName);
        appDef.addTable(tableDef);
        SchemaService.instance().defineApplication(tenant, appDef);
        appDef = SchemaService.instance().getApplication(tenant, appDef.getAppName());
        return appDef.getTableDef(tableName);
    }
1085367
public static function buildTableMap()
    {
      $dbMap = Propel::getDatabaseMap(BaseApiLogPeer::DATABASE_NAME);
      if (!$dbMap->hasTable(BaseApiLogPeer::TABLE_NAME)) {
        $dbMap->addTableObject(new \Slashworks\AppBundle\Model\map\ApiLogTableMap());
      }
    }
120247
def +(table)
      t2 = table.to_a
      t2_header = t2.shift
      raise 'Tables cannot be added due to header mismatch' unless @column_properties.keys == t2_header
      raise 'Tables cannot be added due to column properties mismatch' unless column_properties_eql? table.column_properties
      raise 'Tables cannot be added due to table properties mismatch' unless @table_properties.to_h == table.table_properties.to_h
      TableTransform::Table.new(self.to_a + t2)
    end
982337
def add(self, entries, table=None, columns=None, ignore=False):
        """"""
        # Default table and columns #
        if table is None:   table   = self.main_table
        if columns is None: columns = self.get_columns_of_table(table)
        # Default columns #
        question_marks = ','.join('?' for c in columns)
        cols           = ','.join('"' + c + '"' for c in columns)
        ignore         = " OR IGNORE" if ignore else ""
        sql_command    = 'INSERT%s into "%s"(%s) VALUES (%s);'
        sql_command    = sql_command % (ignore, table, cols, question_marks)
        # Possible errors we want to catch #
        errors  = (sqlite3.OperationalError, sqlite3.ProgrammingError)
        errors += (sqlite3.IntegrityError, sqlite3.InterfaceError, ValueError)
        # Do it #
        try:
            new_cursor = self.own_connection.cursor()
            new_cursor.executemany(sql_command, entries)
        except errors as err:
            raise Exception(self.detailed_error(sql_command, columns, entries, err))
        except KeyboardInterrupt as err:
            print("You interrupted the data insertion.")
            print("Committing everything done up to this point.")
            self.own_connection.commit()
            raise err
1181635
def add_column(self, tablename: str, fieldspec: FIELDSPEC_TYPE) -> int:
        """"""
        sql = "ALTER TABLE {} ADD COLUMN {}".format(
            tablename, self.fielddefsql_from_fieldspec(fieldspec))
        log.info(sql)
        return self.db_exec_literal(sql)
1047967
def AddTableColumns(self, table, columns):
    """"""
    table_columns = self._table_columns.setdefault(table, [])
    for attr in columns:
      if attr not in table_columns:
        table_columns.append(attr)
1354360
function _gpfDefineEntitiesAdd (entityDefinition) {
    _gpfAssert(entityDefinition._instanceBuilder !== null, "Instance builder must be set");
    _gpfAssert(!_gpfDefineEntitiesFindByConstructor(entityDefinition.getInstanceBuilder()), "Already added");
    _gpfDefinedEntities.push(entityDefinition);
}
320556
def __add_text(self, text):
        """"""
        if text is not None and not isinstance(text, six.text_type):
            raise TypeError('Local symbol definition must be a Unicode sequence or None: %r' % text)
        sid = self.__new_sid()
        location = None
        if self.table_type.is_shared:
            location = self.__import_location(sid)
        token = SymbolToken(text, sid, location)
        self.__add(token)
        return token
375165
private TableDescriptor getTableDescriptor(Table table, SchemaDescriptor schemaDescriptor, Store store) {
        TableDescriptor tableDescriptor;
        if (table instanceof View) {
            View view = (View) table;
            ViewDescriptor viewDescriptor = store.create(ViewDescriptor.class);
            viewDescriptor.setUpdatable(view.isUpdatable());
            CheckOptionType checkOption = view.getCheckOption();
            if (checkOption != null) {
                viewDescriptor.setCheckOption(checkOption.name());
            }
            schemaDescriptor.getViews().add(viewDescriptor);
            tableDescriptor = viewDescriptor;
        } else {
            tableDescriptor = store.create(TableDescriptor.class);
            schemaDescriptor.getTables().add(tableDescriptor);
        }
        tableDescriptor.setName(table.getName());
        return tableDescriptor;
    }
649796
public NodeStatus newestDefinition(String application) throws ApplicationUndefinedException {
        if (Objects.equals(application, EnvUtil.getApplication()))
            return LocalNodeManager.singleton.getFullStatus();
        if (ApplicationDiscovery.singleton != null) {
            NodeStatus status = ApplicationDiscovery.singleton.newestDefinition(application);
            if (status != null) return status;
        }
        throw new ApplicationUndefinedException(application);
    }
158375
private void storeApplicationSchema(ApplicationDefinition appDef) {
        String appName = appDef.getAppName();
        Tenant tenant = Tenant.getTenant(appDef);
        DBTransaction dbTran = DBService.instance(tenant).startTransaction();
        dbTran.addColumn(SchemaService.APPS_STORE_NAME, appName, COLNAME_APP_SCHEMA, appDef.toDoc().toJSON());
        dbTran.addColumn(SchemaService.APPS_STORE_NAME, appName, COLNAME_APP_SCHEMA_FORMAT, ContentType.APPLICATION_JSON.toString());
        dbTran.addColumn(SchemaService.APPS_STORE_NAME, appName, COLNAME_APP_SCHEMA_VERSION, Integer.toString(CURRENT_SCHEMA_LEVEL));
        DBService.instance(tenant).commit(dbTran);
    }
789540
function(tablename, context, definer) {
	var me = {};
	var db = common.config.database;

	me.act = new NobleMachine(); // Query subactions are added as states to this.

	var needsTableCreation = (context == 'create');

	function nextQuery(query) {
		me.act.next(db.query(query));
	}

	var definitions = {
		add_column: function(name, type, options) {
			var col = { name: name, type: type };
			_.extend(col, options);
			
			// If we haven't yet made the table, use the first added column as part of the create statement.
			// All following columns are added via ALTER TABLE. This is because a table cannot be created
			// with zero columns.
			if (needsTableCreation) {
				nextQuery("CREATE TABLE `" + tablename + "` ( " + columnToSQL(col) + " ) ENGINE=INNODB;");
				needsTableCreation = false;
			} else {
				nextQuery("ALTER TABLE `" + tablename + "` ADD " + columnToSQL(col) + ";");
			}
		},

		timestamps: function(options) {
			this.column('createdAt', 'datetime', options);
			this.column('updatedAt', 'datetime', options);
		}
	};

	definitions.column = definitions.add_column;
	
	if (context == 'alter') {
		_.extend(definitions, {
			change_column: function(name, type, options) {
				var col = { name: name, type: type };
				_.extend(col, options);

				nextQuery("ALTER TABLE `" + tablename + "` MODIFY " + columnToSQL(col) + ";");
			},

			remove_column: function(name) {
				nextQuery("ALTER TABLE `" + tablename + "` DROP COLUMN `" + name + "`;");
			},

			// There doesn't seem to be a proper RENAME COLUMN statement in MySQL.
			// As such, it is necessary to use CHANGE after extracting the current column definition.
			rename_column: function(name, newname) {
				var act = new NobleMachine(function() {
					act.toNext(db.query("SHOW COLUMNS FROM `" + tablename + "`;"));
				});

				act.next(function(result) {
					var sql = "ALTER TABLE `" + tablename + "` CHANGE `" + name + "` `" + newname + "`";

					result.forEach(function(coldatum) {
						if (coldatum['Field'] == name) {
							sql += " " + coldatum['Type'];
							
							if (coldatum['Null'] == 'NO') {
								sql += " NOT NULL";
							}

							if (coldatum['Key'] == 'PRI') {
								sql += " PRIMARY KEY";
							}

							sql += coldatum['Extra'];

							if (coldatum['Default'] != 'NULL') {
								sql += " DEFAULT " + coldatum['Default'];
							}
						}
					});
					sql += ";";

					act.toNext(db.query(sql));
				});

				me.act.next(act);
			},
		});
	}

	var types = ['primary_key', 'string', 'text', 'integer', 'boolean', 'datetime', 'timestamp']
	types.forEach(function(type) {
		definitions[type] = function() {
			var options = {}; defs = this;

			var args = Array.prototype.slice.call(arguments);

			args.forEach(function(arg) {
				if (typeof arg == "object") {
					_.extend(options, arg);
				} 
			});

			args.forEach(function(arg) {
				if (typeof arg == "string") {
					defs.column(arg, type, options);
				}
			});
		}
	});

	definer(definitions);

	return me;
}
1357234
def add_column(table_name, column_name, type, options = {})
      table_definition = TableDefinition.new

      if !table_definition.respond_to?(type)
        raise Errors::MigrationDefinitionError("Type '#{type}' is not valid for cassandra migration.")
      end

      table_definition.send(type, column_name, options)

      announce_operation "add_column(#{column_name}, #{type})"

      cql =  "ALTER TABLE #{table_name} ADD "
      cql << table_definition.to_add_column_cql
      announce_suboperation cql

      execute cql
    end
1085738
protected function addAdditionTables() : void
    {
        $dbms = strtoupper($this->db->getDBDriver());
        foreach (\constant("static::{$dbms}_ADDITIONAL_TABLES") as $table) {
            $this->tables[]['table_name'] = $table;
        }
    }
555069
def add_dep(self, ):
        
        i = self.dep_tablev.currentIndex()
        item = i.internalPointer()
        if item:
            dep = item.internal_data()
            dep.projects.add(self._project)
            self.deps.append(dep)
            item.set_parent(None)
200773
def add_pk_if_required(db, table, name):
    
    db.metadata.reflect(bind=db.engine)
    cls_dict = {'__tablename__': name}
    if not table.primary_key:
        for column in table.columns:
            column.primary_key = True
        Table(name, db.metadata, *table.columns, extend_existing=True)
        cls_dict['__table__'] = table
        db.metadata.create_all(bind=db.engine)

    return type(str(name), (sandman_model, db.Model), cls_dict)
1029644
def update(cls,table, dic, Id):
        
        if dic:
            req = "UPDATE {table} SET {SET} WHERE id = " + cls.named_style.format('__id') +  " RETURNING * "
            r = abstractRequetesSQL.formate(req, SET=dic, table=table, args=dict(dic, __id=Id))
            return MonoExecutant(r)
        return MonoExecutant((f"SELECT * FROM {table} WHERE id = " + cls.named_style.format('__id'),
                              {"__id": Id}))