Downgrade database.
192401
def downgrade():
    """"""
    op.drop_table('transaction')
    if op._proxy.migration_context.dialect.supports_sequences:
        op.execute(DropSequence(Sequence('transaction_id_seq')))
1281961
public void downgradeLastInode() {
    Preconditions.checkState(endsInInode());
    Preconditions.checkState(!mEntries.isEmpty());
    Preconditions.checkState(mLockMode == LockMode.WRITE);

    InodeEntry last = (InodeEntry) mEntries.get(mEntries.size() - 1);
    LockResource lock = mInodeLockManager.lockInode(last.getInode(), LockMode.READ);
    last.getLock().close();
    mEntries.set(mEntries.size() - 1, new InodeEntry(lock, last.mInode));
    mLockMode = LockMode.READ;
  }
1368418
public function down()
    {
        Schema::drop($this->prefixCmsTable('activations'));
        Schema::drop($this->prefixCmsTable('persistences'));
        Schema::drop($this->prefixCmsTable('reminders'));
        Schema::drop($this->prefixCmsTable('role_users'));
        Schema::drop($this->prefixCmsTable('throttle'));
        Schema::drop($this->prefixCmsTable('roles'));
        Schema::drop($this->prefixCmsTable('users'));
    }
1039211
def rollback(name, database=None, directory=None, verbose=None):
    """"""
    router = get_router(directory, database, verbose)
    router.rollback(name)
574218
def downgrade(account):
    """"""
    d_account = dict(schema_version=1, metadata={'email': account['email']},
                     tags=list(set([account['environment']] + account.get('tags', []))))

    v1_services = {}
    for service in account.get('services', []):
        if service['name'] == 's3':
            if service['metadata'].get('name'):
                d_account['metadata']['s3_name'] = service['metadata']['name']

        elif service['name'] == 'cloudtrail':
            d_account['metadata']['cloudtrail_index'] = service['metadata']['esIndex']
            d_account['metadata']['cloudtrail_kibana_url'] = service['metadata']['kibanaUrl']

        elif service['name'] == 'bastion':
            d_account['bastion'] = service['metadata']['hostname']

        elif service['name'] == 'titus':
            v1_services['titus'] = {
                'stacks': service['metadata']['stacks'],
                'enabled': service['status'][0]['enabled']
            }

        elif service['name'] == 'spinnaker':
            v1_services['spinnaker'] = {
                'name': service['metadata'].get('name', account["name"]),
                'enabled': service['status'][0]['enabled']
            }

        elif service['name'] == 'awwwdit':
            v1_services['awwwdit'] = {
                'enabled': service['status'][0]['enabled']
            }

        elif service['name'] == 'security_monkey':
            v1_services['security_monkey'] = {
                'enabled': service['status'][0]['enabled']
            }

        elif service['name'] == 'poseidon':
            v1_services['poseidon'] = {
                'enabled': service['status'][0]['enabled']
            }

        elif service['name'] == 'rolliepollie':
            v1_services['rolliepollie'] = {
                'enabled': service['status'][0]['enabled']
            }

        elif service['name'] == 'lazyfalcon':
            owner = None

            if service.get('metadata'):
                if service['metadata'].get('owner'):
                    owner = service['metadata']['owner']

            v1_services['lazyfalcon'] = {
                'enabled': service['status'][0]['enabled'],
                'owner': owner
            }

    if account['provider'] == 'aws':
        d_account['metadata']['account_number'] = account['id']

    elif account['provider'] == 'gcp':
        d_account['metadata']['project_id'] = account['id']

    d_account['id'] = account['provider'] + '-' + account['id']
    d_account['cmc_required'] = account['sensitive']
    d_account['name'] = account['name']
    d_account['alias'] = account['aliases']
    d_account['description'] = account['description']
    d_account['owners'] = account['contacts']
    d_account['type'] = account['provider']
    d_account['ours'] = True if account['owner'] == 'netflix' else False
    d_account['netflix'] = True if account['owner'] == 'netflix' else False
    d_account['services'] = v1_services
    d_account['account_status'] = account['account_status']

    return d_account
43280
def downgrade():
    """"""
    # Remove 'created' and 'updated' columns
    op.drop_column('oauthclient_remoteaccount', 'created')
    op.drop_column('oauthclient_remoteaccount', 'updated')

    op.drop_column('oauthclient_remotetoken', 'created')
    op.drop_column('oauthclient_remotetoken', 'updated')

    op.drop_column('oauthclient_useridentity', 'created')
    op.drop_column('oauthclient_useridentity', 'updated')
1232115
def _run_down(self, path, migration, pretend=False):
        
        migration_file = migration["migration"]

        instance = self._resolve(path, migration_file)

        if pretend:
            return self._pretend_to_run(instance, "down")

        if instance.transactional:
            with instance.db.transaction():
                instance.down()
        else:
            instance.down()

        self._repository.delete(migration)

        self._note(
            decode("[<info>OK</>] <info>Rolled back</info> ")
            + "<fg=cyan>%s</>" % migration_file
        )
75086
public function down()
    {
        // Check if the images table exists
        if (Schema::hasTable('images')) {
            if (Schema::hasColumn('images', 'imageable_type')) {
                $images = DB::select('select * from images');
                foreach ($images as $image) {
                    // Get the model name
                    $old_type_array = explode('\\', $image->imageable_type);
                    $last_model = array_pop($old_type_array);
                    
                    // Move image back to old folder
                    $image_folder = Config::get('redminportal::image.upload_dir');
                    $filename_array = explode('/', $image->path);
                    $filename = array_pop($filename_array);
                    
                    switch ($last_model) {
                        case 'Category':
                            $move_file = $this->moveFileOldToNew($image_folder, $image, 'categories');
                            break;
                        case 'Media':
                            $move_file = $this->moveFileOldToNew($image_folder, $image, 'medias');
                            break;
                        case 'Module':
                            $move_file = $this->moveFileOldToNew($image_folder, $image, 'modules');
                            break;
                        case 'Promotion':
                            $move_file = $this->moveFileOldToNew($image_folder, $image, 'promotions');
                            break;
                        default:
                            $move_file = false;
                            break;
                    }
                    
                    // Remove folder if move succeed
                    if ($move_file) {
                        $this->recursiveRemoveDirectory(public_path() . '/' . $move_file);
                    }
                    
                    // Points to old namespace Redooor\\Redminportal\\
                    $old_type = 'Redooor\\Redminportal\\' . $last_model;
                    DB::table('images')
                        ->where('id', $image->id)
                        ->update([
                            'imageable_type' => $old_type,
                            'path' => ($move_file ? $filename : $image->path)
                        ]);
                }
            }
        }
    }
922402
public function down()
	{
        if(Schema::hasTable('hlogeon_scms_pages')){
            Schema::table('hlogeon_scms_pages', function(Blueprint $table){
                $table->dropColumn('reading_time');
                $table->dropColumn('user_id');
                $table->dropColumn('seo_title');
                $table->dropColumn('seo_description');
                $table->dropColumn('seo_keywords');
                DB::statement('ALTER TABLE hlogeon_scms_pages MODIFY COLUMN sidebar text');
            });
        }
	}
360151
public function down()
    {
        if ( ! $this->hasConnection()) {
            Schema::dropIfExists($this->getTableName());

            return;
        }

        Schema::connection($this->getConnection())->dropIfExists($this->getTableName());
    }
1132230
def downgrade():
    """"""
    op.drop_constraint(op.f('fk_oauth2server_token_user_id_accounts_user'),
                       'oauth2server_token', type_='foreignkey')
    op.drop_index(op.f('ix_oauth2server_token_user_id'),
                  table_name='oauth2server_token')
    op.create_foreign_key('fk_oauth2server_token_user_id_accounts_user',
                          'oauth2server_token', 'accounts_user', ['user_id'],
                          ['id'])
    op.drop_constraint(
        op.f('fk_oauth2server_token_client_id_oauth2server_client'),
        'oauth2server_token', type_='foreignkey')
    op.drop_index(op.f('ix_oauth2server_token_client_id'),
                  table_name='oauth2server_token')
    op.create_foreign_key(
        'fk_oauth2server_token_client_id_oauth2server_client',
        'oauth2server_token', 'oauth2server_client', ['client_id'],
        ['client_id'])
    op.drop_constraint(op.f('fk_oauth2server_client_user_id_accounts_user'),
                       'oauth2server_client', type_='foreignkey')
    op.drop_index(op.f('ix_oauth2server_client_user_id'),
                  table_name='oauth2server_client')
    op.create_foreign_key('fk_oauth2server_client_user_id_accounts_user',
                          'oauth2server_client', 'accounts_user', ['user_id'],
                          ['id'])
1317369
public function down()
    {
        $table = $this->table('users');
        $table->removeColumn('timezone');
        $table->update();

        $this->clearModelCache();
    }
869596
public function down()
    {
        // Check if the 2 tables exist
        if (Schema::hasTable('tags') && Schema::hasTable('taggables')) {
            if (! Schema::hasColumn('tags', 'tagable_id') && ! Schema::hasColumn('tags', 'tagable_type')) {
                Schema::table('tags', function($table) {
                    $table->integer('tagable_id')->default(1);
                    $table->string('tagable_type', 32)->default('type');
                });
                $tags = DB::table('tags')->get();
                foreach ($tags as $tag) {
                    $tagable = DB::table('taggables')->where('tag_id', '=', $tag->id)->first();
                    if ($tagable) {
                        // Points to old namespace Redooor\\Redminportal\\
                        $old_type_array = explode('\\', $tagable->taggable_type);
                        $last_model = array_pop($old_type_array);
                        $old_type = 'Redooor\\Redminportal\\' . $last_model;
                        DB::table('tags')
                            ->where('id', $tag->id)
                            ->update([
                                'tagable_id' => $tagable->taggable_id,
                                'tagable_type' => $old_type
                            ]);
                    }
                }
            }
        }
    }
839409
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		if (AbstractDataSource.this.options.databaseLifecycleHandler != null) {
			AbstractDataSource.this.options.databaseLifecycleHandler.onUpdate(db, oldVersion, newVersion, false);
			versionChanged = true;
		}
	}
485804
def dropdb():
    """"""
    manager.db.engine.echo = True
    if prompt_bool("Are you sure you want to lose all your data"):
        manager.db.drop_all()
        metadata, alembic_version = alembic_table_metadata()
        alembic_version.drop()
        manager.db.session.commit()
1145947
private static void deRegisterServer(Server server, Database db) {

        Iterator it = serverMap.values().iterator();

        for (; it.hasNext(); ) {
            HashSet databases = (HashSet) it.next();

            databases.remove(db);

            if (databases.isEmpty()) {
                it.remove();
            }
        }
    }
1109145
public function down()
    {
        DB::statement('SET FOREIGN_KEY_CHECKS=0;');
        Schema::dropIfExists('tbl_widgets');
        Schema::dropIfExists('tbl_widget_types');
        Schema::dropIfExists('tbl_page_closure');
        Schema::dropIfExists('tbl_widgets_params');
        DB::statement('SET FOREIGN_KEY_CHECKS=1;');
    }