mirror of
https://code.castopod.org/adaures/castopod
synced 2025-04-19 04:51:17 +00:00

- rename podlibre to adaures - rename castopod-host to castopod - simplify README and redirect to docs site - move INSTALL and UPDATE docs - add new gitlabci pipeline to deploy docs - upgrade node to v16 in Dockerfile
88 lines
2.3 KiB
PHP
88 lines
2.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* @copyright 2021 Ad Aures
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
* @link https://castopod.org/
|
|
*/
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
class AddMedia extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
$this->forge->addField([
|
|
'id' => [
|
|
'type' => 'INT',
|
|
'unsigned' => true,
|
|
'auto_increment' => true,
|
|
],
|
|
'file_path' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 255,
|
|
],
|
|
'file_size' => [
|
|
'type' => 'INT',
|
|
'unsigned' => true,
|
|
'comment' => 'File size in bytes',
|
|
],
|
|
'file_mimetype' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 45,
|
|
],
|
|
'file_metadata' => [
|
|
'type' => 'JSON',
|
|
'null' => true,
|
|
],
|
|
'type' => [
|
|
'type' => 'ENUM',
|
|
'constraint' => ['image', 'audio', 'video', 'transcript', 'chapters', 'document'],
|
|
'default' => 'document',
|
|
],
|
|
'description' => [
|
|
'type' => 'TEXT',
|
|
'null' => true,
|
|
],
|
|
'language_code' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 2,
|
|
'null' => true,
|
|
],
|
|
'uploaded_by' => [
|
|
'type' => 'INT',
|
|
'unsigned' => true,
|
|
],
|
|
'updated_by' => [
|
|
'type' => 'INT',
|
|
'unsigned' => true,
|
|
],
|
|
'uploaded_at' => [
|
|
'type' => 'DATETIME',
|
|
],
|
|
'updated_at' => [
|
|
'type' => 'DATETIME',
|
|
],
|
|
'deleted_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => true,
|
|
],
|
|
]);
|
|
|
|
$this->forge->addKey('id', true);
|
|
$this->forge->addUniqueKey('file_path');
|
|
$this->forge->addForeignKey('uploaded_by', 'users', 'id');
|
|
$this->forge->addForeignKey('updated_by', 'users', 'id');
|
|
$this->forge->createTable('media');
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
$this->forge->dropTable('media');
|
|
}
|
|
}
|