|
1 | 1 | <?php |
2 | 2 |
|
3 | | -use Phinx\Migration\AbstractMigration; |
| 3 | +use Migrations\BaseMigration; |
4 | 4 |
|
5 | 5 | // phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace |
6 | 6 | // phpcs:disable PSR2R.Classes.ClassFileName.NoMatch |
7 | | -class InitGeo extends AbstractMigration { |
| 7 | +class InitGeo extends BaseMigration { |
8 | 8 |
|
9 | 9 | /** |
10 | 10 | * @inheritDoc |
11 | 11 | */ |
12 | 12 | public function up() { |
13 | | - if (!$this->hasTable('geocoded_addresses')) { |
14 | | - $this->table('geocoded_addresses') |
15 | | - ->addColumn('address', 'string', [ |
16 | | - 'default' => null, |
17 | | - 'limit' => 255, |
18 | | - 'null' => false, |
19 | | - ]) |
20 | | - ->addColumn('formatted_address', 'string', [ |
21 | | - 'default' => null, |
22 | | - 'limit' => 255, |
23 | | - 'null' => true, |
24 | | - ]) |
25 | | - ->addColumn('country', 'string', [ |
26 | | - 'default' => null, |
27 | | - 'limit' => 3, |
28 | | - 'null' => true, |
29 | | - ]) |
30 | | - ->addColumn('lat', 'float', [ |
31 | | - 'default' => null, |
32 | | - 'null' => true, |
33 | | - ]) |
34 | | - ->addColumn('lng', 'float', [ |
35 | | - 'default' => null, |
36 | | - 'null' => true, |
37 | | - ]) |
38 | | - ->addColumn('data', 'text', [ |
39 | | - 'default' => null, |
40 | | - 'limit' => null, |
41 | | - 'null' => true, |
42 | | - ]) |
43 | | - ->addIndex( |
44 | | - [ |
45 | | - 'address', |
46 | | - ], |
47 | | - ['unique' => true], |
48 | | - ) |
49 | | - ->create(); |
50 | | - } |
| 13 | + $this->table('geocoded_addresses') |
| 14 | + ->addColumn('address', 'string', [ |
| 15 | + 'default' => null, |
| 16 | + 'limit' => 255, |
| 17 | + 'null' => false, |
| 18 | + ]) |
| 19 | + ->addColumn('formatted_address', 'string', [ |
| 20 | + 'default' => null, |
| 21 | + 'limit' => 255, |
| 22 | + 'null' => true, |
| 23 | + ]) |
| 24 | + ->addColumn('country', 'string', [ |
| 25 | + 'default' => null, |
| 26 | + 'limit' => 3, |
| 27 | + 'null' => true, |
| 28 | + ]) |
| 29 | + ->addColumn('lat', 'float', [ |
| 30 | + 'default' => null, |
| 31 | + 'null' => true, |
| 32 | + ]) |
| 33 | + ->addColumn('lng', 'float', [ |
| 34 | + 'default' => null, |
| 35 | + 'null' => true, |
| 36 | + ]) |
| 37 | + ->addColumn('data', 'text', [ |
| 38 | + 'default' => null, |
| 39 | + 'limit' => null, |
| 40 | + 'null' => true, |
| 41 | + ]) |
| 42 | + ->addIndex( |
| 43 | + [ |
| 44 | + 'address', |
| 45 | + ], |
| 46 | + ['unique' => true], |
| 47 | + ) |
| 48 | + ->create(); |
51 | 49 | } |
52 | 50 |
|
53 | 51 | /** |
|
0 commit comments