2021-04-02 19:20:02 +02:00
|
|
|
<?php
|
|
|
|
|
2021-06-08 11:52:11 +02:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2021-04-02 19:20:02 +02:00
|
|
|
/**
|
2021-08-27 12:58:22 +02:00
|
|
|
* Class AddPreviewCards Creates preview_cards table in database
|
2021-04-02 19:20:02 +02:00
|
|
|
*
|
2022-02-19 17:06:11 +01:00
|
|
|
* @copyright 2021 Ad Aures
|
2021-04-02 19:20:02 +02:00
|
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
|
|
* @link https://castopod.org/
|
|
|
|
*/
|
|
|
|
|
2021-08-23 13:05:16 +02:00
|
|
|
namespace Modules\Fediverse\Database\Migrations;
|
2021-04-02 19:20:02 +02:00
|
|
|
|
2023-06-13 18:05:02 +02:00
|
|
|
use App\Database\Migrations\BaseMigration;
|
2021-04-02 19:20:02 +02:00
|
|
|
|
2023-06-13 18:05:02 +02:00
|
|
|
class AddPreviewCards extends BaseMigration
|
2021-04-02 19:20:02 +02:00
|
|
|
{
|
2021-05-06 16:00:48 +02:00
|
|
|
public function up(): void
|
2021-04-02 19:20:02 +02:00
|
|
|
{
|
|
|
|
$this->forge->addField([
|
|
|
|
'id' => [
|
2023-06-12 16:47:38 +02:00
|
|
|
'type' => 'INT',
|
|
|
|
'unsigned' => true,
|
2021-04-02 19:20:02 +02:00
|
|
|
'auto_increment' => true,
|
|
|
|
],
|
|
|
|
'url' => [
|
2023-06-12 16:47:38 +02:00
|
|
|
'type' => 'VARCHAR',
|
2021-04-02 19:20:02 +02:00
|
|
|
'constraint' => 512,
|
|
|
|
],
|
|
|
|
'title' => [
|
2023-06-12 16:47:38 +02:00
|
|
|
'type' => 'VARCHAR',
|
2021-04-02 19:20:02 +02:00
|
|
|
'constraint' => 128,
|
|
|
|
],
|
2021-05-19 18:35:13 +02:00
|
|
|
'description' => [
|
|
|
|
'type' => 'TEXT',
|
|
|
|
],
|
2021-04-02 19:20:02 +02:00
|
|
|
'type' => [
|
2023-06-12 16:47:38 +02:00
|
|
|
'type' => 'ENUM',
|
2021-04-02 19:20:02 +02:00
|
|
|
'constraint' => ['link', 'video', 'image', 'rich'],
|
2023-06-12 16:47:38 +02:00
|
|
|
'default' => 'link',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
|
|
|
'author_name' => [
|
2023-06-12 16:47:38 +02:00
|
|
|
'type' => 'VARCHAR',
|
2021-04-02 19:20:02 +02:00
|
|
|
'constraint' => 64,
|
2023-06-12 16:47:38 +02:00
|
|
|
'null' => true,
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
|
|
|
'author_url' => [
|
2023-06-12 16:47:38 +02:00
|
|
|
'type' => 'VARCHAR',
|
2021-04-02 19:20:02 +02:00
|
|
|
'constraint' => 255,
|
2023-06-12 16:47:38 +02:00
|
|
|
'null' => true,
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
|
|
|
'provider_name' => [
|
2023-06-12 16:47:38 +02:00
|
|
|
'type' => 'VARCHAR',
|
2021-04-02 19:20:02 +02:00
|
|
|
'constraint' => 255,
|
|
|
|
],
|
|
|
|
'provider_url' => [
|
2023-06-12 16:47:38 +02:00
|
|
|
'type' => 'VARCHAR',
|
2021-04-02 19:20:02 +02:00
|
|
|
'constraint' => 255,
|
|
|
|
],
|
|
|
|
'image' => [
|
2023-06-12 16:47:38 +02:00
|
|
|
'type' => 'VARCHAR',
|
2021-04-02 19:20:02 +02:00
|
|
|
'constraint' => 255,
|
|
|
|
],
|
|
|
|
'html' => [
|
|
|
|
'type' => 'TEXT',
|
|
|
|
],
|
|
|
|
'updated_at' => [
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
],
|
|
|
|
'created_at' => [
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
],
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->forge->addPrimaryKey('id');
|
|
|
|
$this->forge->addUniqueKey('url');
|
2023-08-26 15:03:01 +02:00
|
|
|
$this->forge->createTable('fediverse_preview_cards');
|
2021-04-02 19:20:02 +02:00
|
|
|
}
|
|
|
|
|
2021-05-06 16:00:48 +02:00
|
|
|
public function down(): void
|
2021-04-02 19:20:02 +02:00
|
|
|
{
|
2023-08-26 15:03:01 +02:00
|
|
|
$this->forge->dropTable('fediverse_preview_cards');
|
2021-04-02 19:20:02 +02:00
|
|
|
}
|
|
|
|
}
|