Drop/Create table with the schema found in the sql directory

@param {Object} options
185677
function syncDB(options) {
  var uri = options.uri || conf.db,
      entries = (options.drop ? scripts('drop') : []).concat(scripts('create')),
      progress = options.progress || noop,
      complete = options.complete || noop;

  connect(uri, function(err, client, done) {
    if(err) { throw err; }
    run(client, done);
  });

  function run(client, done) {
    var entry = entries.shift()
      , script
      , path;

    if(entry !== undefined) {
      script = entry[0];
      path = entry[1];

      progress(script, path);
      client.query(script, function (err) {
        if(err) {
          complete(err);
          done(err);
        } else {
          run(client, done);
        }
      });
    } else {
      complete();
      done();
    }
  }

}
240643
function ( db ) {
          try {
            if ( Array.isArray( options.schemas ) ) {
              options.schemas.forEach(
                function ( schema ) {
                  var keys = Object.keys( schema );

                  db.model( keys[ 0 ], schema[ keys[ 0 ] ] );
                }
              );
            }

            return db;
          } catch ( err ) {
            throw err;
          }
        }
397935
@Override
    public void dropSchema()
    {
        // dropping all the tables in the Oracle NoSQL store
        if (operation != null && operation.equalsIgnoreCase("create-drop"))
        {
            for (TableInfo tableInfo : tableInfos)
            {
                try
                {
                    StatementResult result = tableAPI.executeSync("DROP TABLE IF EXISTS " + tableInfo.getTableName());
                    if (!result.isSuccessful())
                    {
                        throw new SchemaGenerationException("Unable to DROP TABLE " + tableInfo.getTableName());
                    }
                }
                catch (IllegalArgumentException e)
                {
                    logger.error("Invalid DROP TABLE Statement. Caused By: ", e);
                    throw new SchemaGenerationException(e, "Invalid DROP TABLE Statement. Caused By: ");
                }
                catch (FaultException e)
                {
                    logger.error("DROP TABLE Statement couldn't be executed. Caused By: ", e);
                    throw new SchemaGenerationException(e, "Invalid DROP TABLE Statement is executed. Caused By: ");
                }
            }
        }
    }
306096
async function createTable (args) {
    // get args object
    args = requireValidOptionalObject(args)
    // get create table sql
    var createTableSql = sql.createTable(this)
    // debug
    debug(createTableSql)
    // attempt to create table
    await this.mysql().query(createTableSql, {}, {}, args.session)
}
510115
function(schemaName, target, cb, options) {
  var schema  = SCHEMA[schemaName]
    , idField = schema._idField_
    , id      = target[idField]
    , options = options || {}

  if (typeof id == 'undefined' || id === '') {
    cb && cb(new Error('update ' + schemaName + ' failed: ID is not exist'))
    return
  }

  var key = schemaName + ':' + id

  client.hgetall(key, function(err, object) {
    if (!object && options.mode != 'insert') {
      cb && cb(err || new Error('update ' + key + ' failed: object doesn\'t exist'))
      return
    }

    filter(schemaName, target, function(err, result) {
      if (err || result === false) {
        cb && cb(err || new Error('update ' + schemaName + ' failed: invalid field value'))
        return
      }

      client.hmset(schemaName + ':' + id, target, function(err) {
        if (err) {
          cb && cb(err)
          return
        }

        filter(schemaName, target, cb, { FUNCS: COMMANDS, mode: options.mode, oldModel: object  })
      })
    }, { FUNCS: FILTERS, mode: options.mode, oldModel: object })

  })

}
385862
def create_table(cls):
        
        schema_editor = getattr(connection, 'schema_editor', None)
        if schema_editor:
            with schema_editor() as schema_editor:
                schema_editor.create_model(cls)
        else:
            raw_sql, _ = connection.creation.sql_create_model(
                cls,
                no_style(),
                [])
            cls.delete_table()
            cursor = connection.cursor()
            try:
                cursor.execute(*raw_sql)
            finally:
                cursor.close()
452755
void dropIndex(Session session, HsqlName name) {

        Table t = getTable(session, name.parent.name, name.parent.schema.name);
        TableWorks tw = new TableWorks(session, t);

        tw.dropIndex(name.name);
    }
1285024
def create_schema(db):
    """"""
    schema_dir = pkg_resources.resource_filename('git_code_debt', 'schema')
    schema_files = os.listdir(schema_dir)

    for sql_file in schema_files:
        resource_filename = os.path.join(schema_dir, sql_file)
        with open(resource_filename, 'r') as resource:
            db.executescript(resource.read())
951252
private void createTables() {
        this.db.execSQL(DbConstants.DROP_METADATA_STATEMENT);
        this.db.execSQL(DbConstants.DROP_INDEX_STATEMENT);
        this.db.execSQL(DbConstants.DROP_CATEGORY_MAP_STATEMENT);
        this.db.execSQL(DbConstants.DROP_DATA_STATEMENT);
        this.db.execSQL(DbConstants.DROP_CATEGORIES_STATEMENT);

        this.db.execSQL(DbConstants.CREATE_CATEGORIES_STATEMENT);
        this.db.execSQL(DbConstants.CREATE_DATA_STATEMENT);
        this.db.execSQL(DbConstants.CREATE_CATEGORY_MAP_STATEMENT);
        this.db.execSQL(DbConstants.CREATE_INDEX_STATEMENT);
        this.db.execSQL(DbConstants.CREATE_METADATA_STATEMENT);
    }
926290
def _drop_schema(self, force_drop=False):
        
        connection = connections[get_tenant_database_alias()]
        has_schema = hasattr(connection, 'schema_name')
        if has_schema and connection.schema_name not in (self.schema_name, get_public_schema_name()):
            raise Exception("Can't delete tenant outside it's own schema or "
                            "the public schema. Current schema is %s."
                            % connection.schema_name)

        if has_schema and schema_exists(self.schema_name) and (self.auto_drop_schema or force_drop):
            self.pre_drop()
            cursor = connection.cursor()
            cursor.execute('DROP SCHEMA %s CASCADE' % self.schema_name)
985095
def drop(self, force=False):
        
        if not self.exists:
            logger.info("Schema named `{database}` does not exist. Doing nothing.".format(database=self.database))
        elif (not config['safemode'] or
              force or
              user_choice("Proceed to delete entire schema `%s`?" % self.database, default='no') == 'yes'):
            logger.info("Dropping `{database}`.".format(database=self.database))
            try:
                self.connection.query("DROP DATABASE `{database}`".format(database=self.database))
                logger.info("Schema `{database}` was dropped successfully.".format(database=self.database))
            except pymysql.OperationalError:
                raise DataJointError("An attempt to drop schema `{database}` "
                                     "has failed. Check permissions.".format(database=self.database))
271675
public static String generateDropTableDDL(String dbName, String tableName) {
    return String.format("DROP TABLE IF EXISTS `%s`.`%s`", dbName, tableName);
  }
843551
function removeTable(opts: Options, change: Change): Change {
    const { value } = change;
    const { startKey } = value;

    return removeTableByKey(opts, change, startKey);
}
1059104
function removeColumn(opts: Options, change: Change, at: number): Change {
    const { value } = change;
    const { startKey } = value;

    const pos = TablePosition.create(opts, value.document, startKey);

    let columnKey;
    if (typeof at === 'undefined') {
        columnKey = pos.cell.key;
    } else {
        columnKey = pos.row.nodes.get(at).key;
    }

    return removeColumnByKey(opts, change, columnKey);
}
931066
function createTables() {
  // setup config
  var config = require('../config/config.js')

  var db = wc_db.getConnection(config.db)
  var sql = fs.readFileSync('model/Media.sql').toString()
  debug(sql)
  db.query(sql).then(function(ret){
    debug(ret)
  }).catch(function(err) {
    debug(err)
  })

  var sql = fs.readFileSync('model/Rating.sql').toString()
  debug(sql)
  db.query(sql).then(function(ret){
    debug(ret)
  }).catch(function(err) {
    debug(err)
  })

  var sql = fs.readFileSync('model/Tag.sql').toString()
  debug(sql)
  db.query(sql).then(function(ret){
    debug(ret)
  }).catch(function(err) {
    debug(err)
  })

  var sql = fs.readFileSync('model/MediaTag.sql').toString()
  debug(sql)
  db.query(sql).then(function(ret){
    debug(ret)
  }).catch(function(err) {
    debug(err)
  })

  var sql = fs.readFileSync('model/Fragment.sql').toString()
  debug(sql)
  db.query(sql).then(function(ret){
    debug(ret)
  }).catch(function(err) {
    debug(err)
  })

  var sql = fs.readFileSync('model/Meta.sql').toString()
  debug(sql)
  db.query(sql).then(function(ret){
    debug(ret)
  }).catch(function(err) {
    debug(err)
  })

  var sql = fs.readFileSync('model/User.sql').toString()
  debug(sql)
  db.query(sql).then(function(ret){
    debug(ret)
  }).catch(function(err) {
    debug(err)
  })

}
623765
final public function dropTable(string $table, array $options = []) {
        $options += [Db::OPTION_IGNORE => false];
        $this->dropTableDb($table, $options);

        $tableKey = strtolower($table);
        unset($this->tables[$tableKey], $this->tableNames[$tableKey]);
    }
726886
@Override
    public void dropSchema()
    {
        for (TableInfo tableInfo : tableInfos)
        {
            try
            {
                client.deleteTable(tableInfo.getTableName());
            }
            catch (Exception ex)
            {
                logger.error("Error during deleting tables in kudu, Caused by: ", ex);
                throw new SchemaGenerationException(ex, "Kudu");
            }
        }
    }