| @@ 125-138 (lines=14) @@ | ||
| 122 | $this->assertFalse($this->adapter->hasColumn('atable', 'id')); |
|
| 123 | } |
|
| 124 | ||
| 125 | public function testCreateTableWithMultiplePrimaryKeys() |
|
| 126 | { |
|
| 127 | $options = array( |
|
| 128 | 'id' => false, |
|
| 129 | 'primary_key' => array('user_id', 'tag_id') |
|
| 130 | ); |
|
| 131 | $table = new \Phinx\Db\Table('table1', $options, $this->adapter); |
|
| 132 | $table->addColumn('user_id', 'integer') |
|
| 133 | ->addColumn('tag_id', 'integer') |
|
| 134 | ->save(); |
|
| 135 | $this->assertTrue($this->adapter->hasIndex('table1', array('user_id', 'tag_id'))); |
|
| 136 | $this->assertTrue($this->adapter->hasIndex('table1', array('tag_id', 'USER_ID'))); |
|
| 137 | $this->assertFalse($this->adapter->hasIndex('table1', array('tag_id', 'user_email'))); |
|
| 138 | } |
|
| 139 | ||
| 140 | public function testCreateTableWithMultipleIndexes() |
|
| 141 | { |
|
| @@ 145-158 (lines=14) @@ | ||
| 142 | $this->assertFalse($this->adapter->hasColumn('atable', 'id')); |
|
| 143 | } |
|
| 144 | ||
| 145 | public function testCreateTableWithMultiplePrimaryKeys() |
|
| 146 | { |
|
| 147 | $options = array( |
|
| 148 | 'id' => false, |
|
| 149 | 'primary_key' => array('user_id', 'tag_id') |
|
| 150 | ); |
|
| 151 | $table = new \Phinx\Db\Table('table1', $options, $this->adapter); |
|
| 152 | $table->addColumn('user_id', 'integer') |
|
| 153 | ->addColumn('tag_id', 'integer') |
|
| 154 | ->save(); |
|
| 155 | $this->assertTrue($this->adapter->hasIndex('table1', array('user_id', 'tag_id'))); |
|
| 156 | $this->assertTrue($this->adapter->hasIndex('table1', array('tag_id', 'USER_ID'))); |
|
| 157 | $this->assertFalse($this->adapter->hasIndex('table1', array('tag_id', 'user_email'))); |
|
| 158 | } |
|
| 159 | ||
| 160 | public function testCreateTableWithMultipleIndexes() |
|
| 161 | { |
|
| @@ 176-189 (lines=14) @@ | ||
| 173 | $this->assertFalse($this->adapter->hasColumn('atable', 'id')); |
|
| 174 | } |
|
| 175 | ||
| 176 | public function testCreateTableWithMultiplePrimaryKeys() |
|
| 177 | { |
|
| 178 | $options = array( |
|
| 179 | 'id' => false, |
|
| 180 | 'primary_key' => array('user_id', 'tag_id') |
|
| 181 | ); |
|
| 182 | $table = new \Phinx\Db\Table('table1', $options, $this->adapter); |
|
| 183 | $table->addColumn('user_id', 'integer') |
|
| 184 | ->addColumn('tag_id', 'integer') |
|
| 185 | ->save(); |
|
| 186 | $this->assertTrue($this->adapter->hasIndex('table1', array('user_id', 'tag_id'))); |
|
| 187 | $this->assertTrue($this->adapter->hasIndex('table1', array('tag_id', 'USER_ID'))); |
|
| 188 | $this->assertFalse($this->adapter->hasIndex('table1', array('tag_id', 'user_email'))); |
|
| 189 | } |
|
| 190 | ||
| 191 | public function testCreateTableWithMultipleIndexes() |
|
| 192 | { |
|