|
0
|
1 |
<?php |
|
|
2 |
/* |
|
|
3 |
* $Id$ |
|
|
4 |
* |
|
|
5 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
|
6 |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
|
7 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
|
8 |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
|
9 |
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
|
10 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
|
11 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
|
12 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
|
13 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
|
14 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
|
15 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
|
16 |
* |
|
|
17 |
* This software consists of voluntary contributions made by many individuals |
|
|
18 |
* and is licensed under the LGPL. For more information, see |
|
|
19 |
* <http://www.doctrine-project.org>. |
|
|
20 |
*/ |
|
|
21 |
|
|
|
22 |
namespace Doctrine\DBAL\Schema; |
|
|
23 |
|
|
|
24 |
/** |
|
|
25 |
* Table Diff |
|
|
26 |
* |
|
|
27 |
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL |
|
|
28 |
* @link www.doctrine-project.org |
|
|
29 |
* @copyright Copyright (C) 2005-2009 eZ Systems AS. All rights reserved. |
|
|
30 |
* @license http://ez.no/licenses/new_bsd New BSD License |
|
|
31 |
* @since 2.0 |
|
|
32 |
* @version $Revision$ |
|
|
33 |
* @author Benjamin Eberlei <kontakt@beberlei.de> |
|
|
34 |
*/ |
|
|
35 |
class TableDiff |
|
|
36 |
{ |
|
|
37 |
/** |
|
|
38 |
* @var string |
|
|
39 |
*/ |
|
|
40 |
public $name = null; |
|
|
41 |
|
|
|
42 |
/** |
|
|
43 |
* @var string |
|
|
44 |
*/ |
|
|
45 |
public $newName = false; |
|
|
46 |
|
|
|
47 |
/** |
|
|
48 |
* All added fields |
|
|
49 |
* |
|
|
50 |
* @var array(string=>Column) |
|
|
51 |
*/ |
|
|
52 |
public $addedColumns; |
|
|
53 |
|
|
|
54 |
/** |
|
|
55 |
* All changed fields |
|
|
56 |
* |
|
|
57 |
* @var array(string=>Column) |
|
|
58 |
*/ |
|
|
59 |
public $changedColumns = array(); |
|
|
60 |
|
|
|
61 |
/** |
|
|
62 |
* All removed fields |
|
|
63 |
* |
|
|
64 |
* @var array(string=>bool) |
|
|
65 |
*/ |
|
|
66 |
public $removedColumns = array(); |
|
|
67 |
|
|
|
68 |
/** |
|
|
69 |
* Columns that are only renamed from key to column instance name. |
|
|
70 |
* |
|
|
71 |
* @var array(string=>Column) |
|
|
72 |
*/ |
|
|
73 |
public $renamedColumns = array(); |
|
|
74 |
|
|
|
75 |
/** |
|
|
76 |
* All added indexes |
|
|
77 |
* |
|
|
78 |
* @var array(string=>Index) |
|
|
79 |
*/ |
|
|
80 |
public $addedIndexes = array(); |
|
|
81 |
|
|
|
82 |
/** |
|
|
83 |
* All changed indexes |
|
|
84 |
* |
|
|
85 |
* @var array(string=>Index) |
|
|
86 |
*/ |
|
|
87 |
public $changedIndexes = array(); |
|
|
88 |
|
|
|
89 |
/** |
|
|
90 |
* All removed indexes |
|
|
91 |
* |
|
|
92 |
* @var array(string=>bool) |
|
|
93 |
*/ |
|
|
94 |
public $removedIndexes = array(); |
|
|
95 |
|
|
|
96 |
/** |
|
|
97 |
* All added foreign key definitions |
|
|
98 |
* |
|
|
99 |
* @var array |
|
|
100 |
*/ |
|
|
101 |
public $addedForeignKeys = array(); |
|
|
102 |
|
|
|
103 |
/** |
|
|
104 |
* All changed foreign keys |
|
|
105 |
* |
|
|
106 |
* @var array |
|
|
107 |
*/ |
|
|
108 |
public $changedForeignKeys = array(); |
|
|
109 |
|
|
|
110 |
/** |
|
|
111 |
* All removed foreign keys |
|
|
112 |
* |
|
|
113 |
* @var array |
|
|
114 |
*/ |
|
|
115 |
public $removedForeignKeys = array(); |
|
|
116 |
|
|
|
117 |
/** |
|
|
118 |
* Constructs an TableDiff object. |
|
|
119 |
* |
|
|
120 |
* @param array(string=>Column) $addedColumns |
|
|
121 |
* @param array(string=>Column) $changedColumns |
|
|
122 |
* @param array(string=>bool) $removedColumns |
|
|
123 |
* @param array(string=>Index) $addedIndexes |
|
|
124 |
* @param array(string=>Index) $changedIndexes |
|
|
125 |
* @param array(string=>bool) $removedIndexes |
|
|
126 |
*/ |
|
|
127 |
public function __construct($tableName, $addedColumns = array(), |
|
|
128 |
$changedColumns = array(), $removedColumns = array(), $addedIndexes = array(), |
|
|
129 |
$changedIndexes = array(), $removedIndexes = array()) |
|
|
130 |
{ |
|
|
131 |
$this->name = $tableName; |
|
|
132 |
$this->addedColumns = $addedColumns; |
|
|
133 |
$this->changedColumns = $changedColumns; |
|
|
134 |
$this->removedColumns = $removedColumns; |
|
|
135 |
$this->addedIndexes = $addedIndexes; |
|
|
136 |
$this->changedIndexes = $changedIndexes; |
|
|
137 |
$this->removedIndexes = $removedIndexes; |
|
|
138 |
} |
|
|
139 |
} |