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