forge->addField([ 'id' => [ 'type' => 'INT', 'unsigned' => true, 'auto_increment' => true, ], 'podcast_id' => [ 'type' => 'INT', 'unsigned' => true, ], 'email' => [ 'type' => 'VARCHAR', 'constraint' => 255, ], 'token' => [ 'type' => 'VARCHAR', 'constraint' => 64, ], 'status' => [ 'type' => 'ENUM', 'constraint' => ['active', 'suspended'], 'default' => 'active', ], 'status_message' => [ 'type' => 'VARCHAR', 'constraint' => 255, 'null' => true, ], 'expires_at' => [ 'type' => 'DATETIME', 'null' => true, ], 'created_by' => [ 'type' => 'INT', 'unsigned' => true, ], 'updated_by' => [ 'type' => 'INT', 'unsigned' => true, ], 'created_at' => [ 'type' => 'DATETIME', ], 'updated_at' => [ 'type' => 'DATETIME', ], ]); $this->forge->addKey('id', true); $this->forge->addUniqueKey(['podcast_id', 'email']); $this->forge->addUniqueKey('token'); $this->forge->addForeignKey('podcast_id', 'podcasts', 'id', '', 'CASCADE'); $this->forge->addForeignKey('created_by', 'users', 'id'); $this->forge->addForeignKey('updated_by', 'users', 'id'); $this->forge->createTable('subscriptions'); } public function down(): void { $this->forge->dropTable('subscriptions'); } }