Initial import of animal_management module

This commit is contained in:
Kelin Rescue Hub
2026-04-04 13:13:00 -04:00
commit 20adb1bd1e
65 changed files with 14004 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
<?php
use humhub\components\Migration;
class m260403_120000_create_animal_gallery_link extends Migration
{
public function safeUp()
{
if ($this->db->getSchema()->getTableSchema('rescue_animal_gallery_link', true) !== null) {
return;
}
$this->safeCreateTable('rescue_animal_gallery_link', [
'id' => $this->primaryKey(),
'animal_id' => $this->integer()->notNull(),
'gallery_id' => $this->integer()->notNull(),
'contentcontainer_id' => $this->integer()->notNull(),
'created_at' => $this->dateTime()->null(),
'updated_at' => $this->dateTime()->null(),
]);
$this->safeCreateIndex('idx_rescue_animal_gallery_link_animal', 'rescue_animal_gallery_link', 'animal_id', true);
$this->safeCreateIndex('idx_rescue_animal_gallery_link_gallery', 'rescue_animal_gallery_link', 'gallery_id', true);
$this->safeCreateIndex('idx_rescue_animal_gallery_link_container', 'rescue_animal_gallery_link', 'contentcontainer_id', false);
if ($this->db->getSchema()->getTableSchema('rescue_animal', true) !== null) {
$this->safeAddForeignKey(
'fk_rescue_animal_gallery_link_animal',
'rescue_animal_gallery_link',
'animal_id',
'rescue_animal',
'id',
'CASCADE',
'CASCADE'
);
}
if ($this->db->getSchema()->getTableSchema('gallery_gallery', true) !== null) {
$this->safeAddForeignKey(
'fk_rescue_animal_gallery_link_gallery',
'rescue_animal_gallery_link',
'gallery_id',
'gallery_gallery',
'id',
'CASCADE',
'CASCADE'
);
}
}
public function safeDown()
{
$this->safeDropTable('rescue_animal_gallery_link');
}
}