Skip to content

Commit 5b81ad9

Browse files
Release 1.2.9
1 parent 857d1a1 commit 5b81ad9

File tree

5 files changed

+53
-4
lines changed

5 files changed

+53
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## 1.2.9 - 2025-06-17
6+
### Fixed
7+
- Resolved an issue where the bulk translation exclusions table was not created correctly on systems with `sql_require_primary_key` enabled.
8+
59
## 1.2.8 - 2025-06-12
610
### Added
711
- Support for DeepL glossaries.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "convergine/craft-content-buddy",
33
"description": "Content Buddy is an AI-driven CraftCMS plugin that leverages the ChatGPT API to automatically generate and manage multi-language content, including text and images, with customizable settings and features for precise control and enhanced content creation.",
44
"type": "craft-plugin",
5-
"version": "1.2.8",
5+
"version": "1.2.9",
66
"keywords": [
77
"craftcms",
88
"content-buddy",

src/BuddyPlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
class BuddyPlugin extends Plugin {
4242
public static string $plugin;
4343
public ?string $name = 'Content Buddy';
44-
public string $schemaVersion = '1.2.8';
44+
public string $schemaVersion = '1.2.9';
4545

4646
public function init() {
4747
/* plugin initialization */

src/migrations/m250612_081315_exclude_from_bulk_translations.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ public function safeUp(): bool
2121
$this->archiveTableIfExists( ExcludeFromBulk::tableName() );
2222
if(!$this->db->tableExists(ExcludeFromBulk::tableName())) {
2323
$this->createTable( ExcludeFromBulk::tableName(), [
24-
'elementId' => $this->integer(),
25-
'siteId' => $this->integer(),
24+
'id' => $this->primaryKey(),
25+
'elementId' => $this->integer(),
26+
'siteId' => $this->integer(),
2627
'dateCreated' => $this->dateTime()->notNull(),
2728
'dateUpdated' => $this->dateTime()->notNull(),
2829
'uid' => $this->uid(),
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
namespace convergine\contentbuddy\migrations;
4+
5+
use convergine\contentbuddy\records\ExcludeFromBulk;
6+
use craft\db\Migration;
7+
8+
/**
9+
* m250617_110743_add_primary_key_to_exclude_table migration.
10+
*/
11+
class m250617_110743_add_primary_key_to_exclude_table extends Migration
12+
{
13+
public function safeUp(): bool
14+
{
15+
$table = ExcludeFromBulk::tableName();
16+
17+
if(!$this->db->tableExists($table)) {
18+
return true;
19+
}
20+
21+
$primaryKeys = $this->getPrimaryKeyColumns($table);
22+
if(!empty($primaryKeys)) {
23+
return true;
24+
}
25+
26+
$this->addColumn($table, 'id', $this->primaryKey()->first());
27+
28+
return true;
29+
}
30+
31+
public function safeDown(): bool
32+
{
33+
return true;
34+
}
35+
36+
/**
37+
* Get primary key columns for a table
38+
*/
39+
private function getPrimaryKeyColumns(string $tableName): array
40+
{
41+
$schema = $this->db->getSchema()->getTableSchema($tableName);
42+
return $schema?->primaryKey ?? [];
43+
}
44+
}

0 commit comments

Comments
 (0)