1
0
mirror of synced 2025-01-08 10:07:10 +03:00
doctrine2/sandbox/migrations/012_apply_foreign_key_constraints.class.php

112 lines
3.6 KiB
PHP

<?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class ApplyForeignKeyConstraints extends Doctrine_Migration
{
public function up()
{
$this->createForeignKey('adult', array (
'local' => 'contact_id',
'foreign' => 'id',
'foreignTable' => 'contact',
'onUpdate' => NULL,
'onDelete' => NULL,
'name' => 'adult_contact_contact_id_id',
)); $this->createForeignKey('child', array (
'local' => 'adult_id',
'foreign' => 'id',
'foreignTable' => 'adult',
'onUpdate' => NULL,
'onDelete' => NULL,
'name' => 'child_adult_adult_id_id',
)); $this->createForeignKey('dog', array (
'local' => 'user_id',
'foreign' => 'id',
'foreignTable' => 'user',
'onUpdate' => NULL,
'onDelete' => NULL,
'name' => 'dog_user_user_id_id',
)); $this->createForeignKey('self_reference', array (
'local' => 'user_id1',
'foreign' => 'id',
'foreignTable' => 'user',
'onUpdate' => NULL,
'onDelete' => NULL,
'name' => 'self_reference_user_user_id1_id',
)); $this->createForeignKey('self_reference', array (
'local' => 'user_id2',
'foreign' => 'id',
'foreignTable' => 'user',
'onUpdate' => NULL,
'onDelete' => NULL,
'name' => 'self_reference_user_user_id2_id',
)); $this->createForeignKey('self_reference', array (
'local' => 'parent_self_reference_id',
'foreign' => 'id',
'foreignTable' => 'self_reference',
'onUpdate' => NULL,
'onDelete' => NULL,
'name' => 'self_reference_self_reference_parent_self_reference_id_id',
)); $this->createForeignKey('self_reference', array (
'local' => 'parent_self_reference_id2',
'foreign' => 'id',
'foreignTable' => 'self_reference',
'onUpdate' => NULL,
'onDelete' => NULL,
'name' => 'self_reference_self_reference_parent_self_reference_id2_id',
)); $this->createForeignKey('user', array (
'local' => 'contact_id',
'foreign' => 'id',
'foreignTable' => 'contact',
'onUpdate' => NULL,
'onDelete' => NULL,
'name' => 'user_contact_contact_id_id',
)); $this->createForeignKey('user_car', array (
'local' => 'user_id',
'foreign' => 'id',
'foreignTable' => 'user',
'onUpdate' => NULL,
'onDelete' => NULL,
'name' => 'user_car_user_user_id_id',
)); $this->createForeignKey('user_car', array (
'local' => 'car_id',
'foreign' => 'id',
'foreignTable' => 'car',
'onUpdate' => NULL,
'onDelete' => NULL,
'name' => 'user_car_car_car_id_id',
)); $this->createForeignKey('user_group', array (
'local' => 'user_id',
'foreign' => 'id',
'foreignTable' => 'user',
'onUpdate' => NULL,
'onDelete' => NULL,
'name' => 'user_group_user_user_id_id',
)); $this->createForeignKey('user_group', array (
'local' => 'group_id',
'foreign' => 'id',
'foreignTable' => 'groups',
'onUpdate' => NULL,
'onDelete' => NULL,
'name' => 'user_group_groups_group_id_id',
));
}
public function down()
{
$this->dropForeignKey('adult', 'adult_contact_contact_id_id');
$this->dropForeignKey('child', 'child_adult_adult_id_id');
$this->dropForeignKey('dog', 'dog_user_user_id_id');
$this->dropForeignKey('self_reference', 'self_reference_user_user_id1_id');
$this->dropForeignKey('self_reference', 'self_reference_user_user_id2_id');
$this->dropForeignKey('self_reference', 'self_reference_self_reference_parent_self_reference_id_id');
$this->dropForeignKey('self_reference', 'self_reference_self_reference_parent_self_reference_id2_id');
$this->dropForeignKey('user', 'user_contact_contact_id_id');
$this->dropForeignKey('user_car', 'user_car_user_user_id_id');
$this->dropForeignKey('user_car', 'user_car_car_car_id_id');
$this->dropForeignKey('user_group', 'user_group_user_user_id_id');
$this->dropForeignKey('user_group', 'user_group_groups_group_id_id');
}
}