protected function buildMigration(\Doctrine\DBAL\Schema\Schema $newSchema, \Doctrine\DBAL\Schema\Schema $oldSchema, $drop) {
		$comparator = new \Doctrine\DBAL\Schema\Comparator;
		$schemaDiff = $comparator->compare($oldSchema, $newSchema);

		$res = '';

		if($drop) {
			foreach($schemaDiff->removedTables as $tableName=>$table)
				$res .= $this->dropTable($tableName);
		}
		else {
			foreach($schemaDiff->newTables as $tableName=>$table)
				$res .= $this->createTable($tableName, $table);
		}

		foreach($schemaDiff->changedTables as $tableName=>$table) {
			$colsRes = '';

			foreach($table->addedColumns as $colName=>$col)
				$colsRes .= $this->createColumn($colName, $col);

			foreach($table->changedColumns as $colName=>$col)
				$colsRes .= $this->updateColumn($colName, $col);

			foreach($table->renamedColumns as $colName=>$col)
				$colsRes .= $this->renameColumn($colName, $col);

			foreach($table->removedColumns as $colName=>$col)
				$colsRes .= $this->dropColumn($colName);

			foreach($table->addedIndexes as $index)
				$colsRes .= $this->createIndex($index);

			foreach($table->removedIndexes as $indexName=>$index)
				$colsRes .= $this->dropIndex($indexName);

			foreach($table->addedForeignKeys as $key)
				$colsRes .= $this->createForeignKey($key);

			foreach($table->removedForeignKeys as $key)
				$colsRes .= $this->dropForeignKey($key);

			if($colsRes)
				$res .= "\$this->schema->table('$tableName', function(\$table) {".$colsRes."\n});\n\n";
		}

		return trim($res, "\n");
	}