/**
  * @param AbstractTable $table
  * @param RecordSchema  $record
  */
 public function __construct(AbstractTable $table, RecordSchema $record)
 {
     $altered = [];
     foreach ($table->alteredColumns() as $column) {
         $altered[] = $column->getName();
     }
     parent::__construct(\Spiral\interpolate('Passive table "{database}"."{table}" ({record}), were altered, columns: {columns}', ['database' => $record->getDatabase(), 'table' => $table->getName(), 'record' => $record, 'columns' => join(', ', $altered)]));
 }
 /**
  * Check if parent and related records belongs to same database, it will allow ORM to use joins
  * to preload or filter by related data.
  *
  * @return bool
  * @throws SchemaException
  */
 public function isSameDatabase()
 {
     if (!$this->builder->hasRecord($this->target)) {
         //Usually it tells us that relation relates to many different records (polymorphic)
         //We can't clearly say
         return false;
     }
     //Databases must be the same
     return $this->record->getDatabase() == $this->outerRecord()->getDatabase();
 }