|
| 1 | +<?php |
| 2 | +declare(strict_types=1); |
| 3 | + |
| 4 | +use Migrations\AbstractMigration; |
| 5 | + |
| 6 | +class AddCrodSourceRescueProject extends AbstractMigration |
| 7 | +{ |
| 8 | + /** |
| 9 | + * up method. |
| 10 | + * |
| 11 | + * @return void |
| 12 | + */ |
| 13 | + public function up() |
| 14 | + { |
| 15 | + $this->table('projects')->insert([ |
| 16 | + 'title' => 'CrowdSource Rescue', |
| 17 | + 'website' => 'https://crowdsourcerescue.com/', |
| 18 | + 'slug' => 'crowdsource-rescue', |
| 19 | + 'technologies' => '', |
| 20 | + 'brief_description' => "CrowdSource Rescue is a Texas based disaster response non-profit that has helped rescue over 60,000 victims of natural disasters", |
| 21 | + 'description' => "<p><strong>CrowdSource Rescue</strong> is a Texas based disaster response non-profit that has helped rescue over 60,000 victims of natural disasters by connecting them to nearby volunteers and first responders.</p> |
| 22 | + <p>It utilizes <strong>CakePHP</strong> to build fast, support high-traffic applications, and trusts <strong>Cake's framework</strong> during literal life-and-death situations.</p>", |
| 23 | + 'is_highlighted' => 1, |
| 24 | + 'is_showcase' => 1, |
| 25 | + 'created' => date('Y-m-d H:i:s'), |
| 26 | + 'modified' => date('Y-m-d H:i:s'), |
| 27 | + ])->save(); |
| 28 | + |
| 29 | + $result = $this->fetchRow("SELECT id FROM projects WHERE title like 'CrowdSource Rescue'"); |
| 30 | + |
| 31 | + $this->table('uploaded_files')->insert([ |
| 32 | + 'file' => 'crowdsource-rescue.png', |
| 33 | + 'dir' => 'webroot/files/PerspectiveImages/file/1716802210.2311', |
| 34 | + 'size' => '91539', |
| 35 | + 'type' => 'image/png', |
| 36 | + 'created' => date('Y-m-d H:i:s'), |
| 37 | + 'modified' => date('Y-m-d H:i:s'), |
| 38 | + 'entity_id' => $result['id'], |
| 39 | + 'model' => 'PerspectiveImages', |
| 40 | + ])->save(); |
| 41 | + $this->table('uploaded_files')->insert([ |
| 42 | + 'file' => 'crowdsource-rescue.png', |
| 43 | + 'dir' => 'webroot/files/ScreenMonitorImages/file/1716802210.2389', |
| 44 | + 'size' => '91539', |
| 45 | + 'type' => 'image/png', |
| 46 | + 'created' => date('Y-m-d H:i:s'), |
| 47 | + 'modified' => date('Y-m-d H:i:s'), |
| 48 | + 'entity_id' => $result['id'], |
| 49 | + 'model' => 'ScreenMonitorImages', |
| 50 | + ])->save(); |
| 51 | + } |
| 52 | + |
| 53 | + /** |
| 54 | + * down method. |
| 55 | + * |
| 56 | + * @return void |
| 57 | + */ |
| 58 | + public function down() |
| 59 | + { |
| 60 | + $this->query("DELETE FROM uploaded_files WHERE file like 'crowdsource-rescue.png'"); |
| 61 | + $this->query("DELETE FROM projects WHERE title like 'CrowdSource Rescue'"); |
| 62 | + } |
| 63 | +} |
0 commit comments