From e3e5033fec3922ccbee70105475c744a93bd795c Mon Sep 17 00:00:00 2001
From: parsa aghaei
Date: Tue, 23 Jun 2026 20:00:35 +0330
Subject: [PATCH] fix: add json translation columns migration, re-add /vendor
to .gitignore
---
.gitignore | 1 +
..._translation_columns_to_website_tables.php | 73 +++++++++++++++++++
2 files changed, 74 insertions(+)
create mode 100644 database/migrations/2026_06_23_100000_add_json_translation_columns_to_website_tables.php
diff --git a/.gitignore b/.gitignore
index 3f8b540..afa306b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@
/public/hot
/public/storage
/storage/*.key
+/vendor
.env
.env.backup
.env.production
diff --git a/database/migrations/2026_06_23_100000_add_json_translation_columns_to_website_tables.php b/database/migrations/2026_06_23_100000_add_json_translation_columns_to_website_tables.php
new file mode 100644
index 0000000..672cb05
--- /dev/null
+++ b/database/migrations/2026_06_23_100000_add_json_translation_columns_to_website_tables.php
@@ -0,0 +1,73 @@
+json('title')->nullable()->after('image');
+ }
+ if (!Schema::hasColumn('website_about_me', 'description')) {
+ $table->json('description')->nullable()->after('title');
+ }
+ });
+
+ // Migrate data from translations table to JSON columns
+ DB::statement('
+ UPDATE website_about_me a
+ SET a.title = (
+ SELECT JSON_OBJECTAGG(locale, title)
+ FROM website_about_me_translations t
+ WHERE t.about_me_id = a.id
+ ),
+ a.description = (
+ SELECT JSON_OBJECTAGG(locale, description)
+ FROM website_about_me_translations t
+ WHERE t.about_me_id = a.id
+ )
+ ');
+
+ // Add JSON columns for spatie/laravel-translatable on website_skills
+ Schema::table('website_skills', function (Blueprint $table) {
+ if (!Schema::hasColumn('website_skills', 'title')) {
+ $table->json('title')->nullable()->after('image');
+ }
+ if (!Schema::hasColumn('website_skills', 'description')) {
+ $table->json('description')->nullable()->after('title');
+ }
+ });
+
+ // Migrate data from skill translations table to JSON columns
+ DB::statement('
+ UPDATE website_skills s
+ SET s.title = (
+ SELECT JSON_OBJECTAGG(locale, title)
+ FROM website_skill_translations t
+ WHERE t.skill_id = s.id
+ ),
+ s.description = (
+ SELECT JSON_OBJECTAGG(locale, description)
+ FROM website_skill_translations t
+ WHERE t.skill_id = s.id
+ )
+ ');
+ }
+
+ public function down(): void
+ {
+ Schema::table('website_about_me', function (Blueprint $table) {
+ $table->dropColumn(['title', 'description']);
+ });
+
+ Schema::table('website_skills', function (Blueprint $table) {
+ $table->dropColumn(['title', 'description']);
+ });
+ }
+};