fix: 🗃️ some changes related to database comments

This commit is contained in:
Alexis Gousseau 2026-01-20 15:28:57 +01:00
parent baae612278
commit b11afcb25b
2 changed files with 473 additions and 161 deletions

View file

@ -14,196 +14,198 @@ return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
{
app()->setLocale('fr');
$jsonPath = Storage::disk('local')->get('document.json');
if (file_exists($jsonPath)) {
app()->setLocale('fr');
$json = Storage::disk('local')->get('document.json');
$data = json_decode($json, true);
$logFile = public_path('documents-error.log');
file_put_contents($logFile, '');
$groups = [];
$json = Storage::disk('local')->get('document.json');
$data = json_decode($json, true);
$logFile = public_path('documents-error.log');
file_put_contents($logFile, '');
$groups = [];
foreach ($data['documents'] as $doc) {
$trid = $doc['translation_group_id'];
$lang = $doc['language'];
foreach ($data['documents'] as $doc) {
$trid = $doc['translation_group_id'];
$lang = $doc['language'];
if (!isset($groups[$trid])) {
$groups[$trid] = [];
}
// Si une langue est déjà présente : doublon de langue dans un groupe
if (isset($groups[$trid][$lang])) {
file_put_contents(
$logFile,
"❌ Doublon de langue '$lang' pour TRID $trid. IDs : " .
$groups[$trid][$lang]['ID'] . " et " . $doc['ID'] . "\n",
FILE_APPEND
);
}
$groups[$trid][$lang] = $doc;
// Vérification n°1 : plus de 2 entrées dans un TRID
if (count($groups[$trid]) > 2) {
$ids = array_column($groups[$trid], 'ID');
file_put_contents(
$logFile,
"❌ Plus de 2 entrées pour TRID $trid. IDs : " . implode(',', $ids) . "\n",
FILE_APPEND
);
}
// Vérification n°2 : si on a 2 entrées mais même langue
if (count($groups[$trid]) === 2) {
$langs = array_keys($groups[$trid]);
if ($langs[0] === $langs[1]) {
$ids = array_column($groups[$trid], 'ID');
if (!isset($groups[$trid])) {
$groups[$trid] = [];
}
// Si une langue est déjà présente : doublon de langue dans un groupe.
if (isset($groups[$trid][$lang])) {
file_put_contents(
$logFile,
"❌ 2 entrées mais même langue '$langs[0]' pour TRID $trid. IDs : "
. implode(',', $ids) . "\n",
"❌ Doublon de langue '$lang' pour TRID $trid. IDs : " .
$groups[$trid][$lang]['ID'] . " et " . $doc['ID'] . "\n",
FILE_APPEND
);
}
}
}
foreach ($groups as $trid => $langs) {
if (!isset($langs['fr'])) {
// Cas anormal : pas de FR → log
file_put_contents(
$logFile,
"❌ Pas de FR pour TRID $trid. IDs trouvés : " . json_encode(array_column($langs, 'ID')) . "\n",
FILE_APPEND
);
// continue;
}
$financeDocument = new Document();
$hasFrCats = false;
$hasFrTags = false;
$hasPublished_at = false;
$hasStatus = false;
$hasFrExercice = false;
// ------------------------------
// 2) Enregistrer la version FR
// ------------------------------
if (isset($langs['fr'])) {
$fr = $langs['fr'];
$hasFrExercice = true;
$financeDocument->exercice = $this->getExerciceEnumFromOldValues($fr, 'fr');
$financeDocument->name = $fr['post_title'];
$financeDocument->published_at = $fr['post_date'];
$hasPublished_at = true;
$hasStatus = true;
$financeDocument->status = $fr['post_status'] === "publish" ?
DocumentStatusEnum::published->value :
DocumentStatusEnum::unpublished->value;
$financeDocument->path = FileHelper::storeFile($financeDocument, $this->replaceUrl($fr));
if (!$this->replaceUrl($fr)) {
$financeDocument->issuu_path = DocumentHelper::extractDocumentFromIssuIframe($fr['post_content']);
$financeDocument->is_issuu = true;
$groups[$trid][$lang] = $doc;
// Vérification n°1 : plus de 2 entrées dans un TRID.
if (count($groups[$trid]) > 2) {
$ids = array_column($groups[$trid], 'ID');
file_put_contents(
$logFile,
"❌ Plus de 2 entrées pour TRID $trid. IDs : " . implode(',', $ids) . "\n",
FILE_APPEND
);
}
// jusque la ça enregistre un element
// il faut maintenant récupérer la valeur de translation_group_id
// si un autre élément dans la liste à le même translation_group_id vérifier que son language est bien "en"
// si c'est le cas alors on app()->setLocale('en')
// puis on réenregistre les nouvelles valeurs translatable :
// $financeDocument->name = $doc['post_title'];
// $financeDocument->path = $localeUrl;
// et on save
// si le langage est autre chose on log dans un fichier (dans public/documents-error.log)
// dans le fichier de log on va écrire à chaque fois l'id du post "ID" fr + en s'il y a + celui qui serait un autre fr, en ou autre pour que je puisse les retrouver
// et on notera plus ou moins l'erreur dont il s'agit
$financeDocument->saveQuietly();
$cats = $this->findCategoryByOldSlug($fr, 'fr');
if ($cats) {
$financeDocument->categories()->sync($cats);
$hasFrCats = true;
}
$tags = $this->findTagsByOldSlug($fr, 'fr');
if ($tags) {
$financeDocument->tags()->sync($tags);
$hasFrTags = true;
// Vérification n°2 : si on a 2 entrées mais même langue.
if (count($groups[$trid]) === 2) {
$langs = array_keys($groups[$trid]);
if ($langs[0] === $langs[1]) {
$ids = array_column($groups[$trid], 'ID');
file_put_contents(
$logFile,
"❌ 2 entrées mais même langue '$langs[0]' pour TRID $trid. IDs : "
. implode(',', $ids) . "\n",
FILE_APPEND
);
}
}
}
if (isset($langs['en'])) {
$en = $langs['en'];
app()->setLocale('en');
if (!$hasPublished_at) {
$financeDocument->published_at = $en['post_date'];
foreach ($groups as $trid => $langs) {
if (!isset($langs['fr'])) {
// Cas anormal : pas de FR → log.
file_put_contents(
$logFile,
"❌ Pas de FR pour TRID $trid. IDs trouvés : " . json_encode(array_column($langs, 'ID')) . "\n",
FILE_APPEND
);
// continue;
}
if (!$hasStatus) {
$financeDocument->status = $en['post_status'] === "publish" ?
$financeDocument = new Document();
$hasFrCats = false;
$hasFrTags = false;
$hasPublished_at = false;
$hasStatus = false;
$hasFrExercice = false;
// ------------------------------
// 2) Enregistrer la version FR
// ------------------------------
if (isset($langs['fr'])) {
$fr = $langs['fr'];
$hasFrExercice = true;
$financeDocument->exercice = $this->getExerciceEnumFromOldValues($fr, 'fr');
$financeDocument->name = $fr['post_title'];
$financeDocument->published_at = $fr['post_date'];
$hasPublished_at = true;
$hasStatus = true;
$financeDocument->status = $fr['post_status'] === "publish" ?
DocumentStatusEnum::published->value :
DocumentStatusEnum::unpublished->value;
$financeDocument->path = FileHelper::storeFile($financeDocument, $this->replaceUrl($fr));
if (!$this->replaceUrl($fr)) {
$financeDocument->issuu_path = DocumentHelper::extractDocumentFromIssuIframe($fr['post_content']);
$financeDocument->is_issuu = true;
}
// jusque la ça enregistre un element
// il faut maintenant récupérer la valeur de translation_group_id
// si un autre élément dans la liste à le même translation_group_id vérifier que son language est bien "en"
// si c'est le cas alors on app()->setLocale('en')
// puis on réenregistre les nouvelles valeurs translatable :
// $financeDocument->name = $doc['post_title'];
// $financeDocument->path = $localeUrl;
// et on save
// si le langage est autre chose on log dans un fichier (dans public/documents-error.log)
// dans le fichier de log on va écrire à chaque fois l'id du post "ID" fr + en s'il y a + celui qui serait un autre fr, en ou autre pour que je puisse les retrouver
// et on notera plus ou moins l'erreur dont il s'agit
$financeDocument->saveQuietly();
$cats = $this->findCategoryByOldSlug($fr, 'fr');
if ($cats) {
$financeDocument->categories()->sync($cats);
$hasFrCats = true;
}
$tags = $this->findTagsByOldSlug($fr, 'fr');
if ($tags) {
$financeDocument->tags()->sync($tags);
$hasFrTags = true;
}
}
$financeDocument->name = $en['post_title'];
if (isset($langs['en'])) {
$en = $langs['en'];
app()->setLocale('en');
if ($hasFrExercice) {
$financeDocument->exercice = $this->getExerciceEnumFromOldValues($en, 'en');
}
if (!$hasPublished_at) {
$financeDocument->published_at = $en['post_date'];
}
$sourceUrl = $this->replaceUrl($en);
if (!$hasStatus) {
$financeDocument->status = $en['post_status'] === "publish" ?
DocumentStatusEnum::published->value :
DocumentStatusEnum::unpublished->value;
}
$financeDocument->name = $en['post_title'];
if (empty($sourceUrl)) {
if ($hasFrExercice) {
$financeDocument->exercice = $this->getExerciceEnumFromOldValues($en, 'en');
}
$sourceUrl = $this->replaceUrl($en);
if (empty($sourceUrl)) {
file_put_contents(
$logFile,
"❌ URL EN vide — TRID $trid — ID {$en['ID']}\n",
FILE_APPEND
);
}
$financeDocument->path = FileHelper::storeFile($financeDocument, $sourceUrl);
if (!$this->replaceUrl($en)) {
$financeDocument->issuu_path = DocumentHelper::extractDocumentFromIssuIframe($en['post_content']);
$financeDocument->is_issuu = true;
}
$financeDocument->saveQuietly();
if (!$hasFrCats) {
$cats = $this->findCategoryByOldSlug($en, 'en');
$financeDocument->categories()->sync($cats);
}
if (!$hasFrTags) {
$tags = $this->findTagsByOldSlug($fr, 'en');
$financeDocument->tags()->sync($tags);
}
app()->setLocale('fr');
} else {
// ------------------------------
// 4) Cas : pas de traduction EN → log
// ------------------------------
$id = isset($langs['fr']) ? $langs['fr']['ID'] : "inconnu";
file_put_contents(
$logFile,
"❌ URL EN vide — TRID $trid — ID {$en['ID']}\n",
"⚠️ Pas de traduction EN pour TRID $trid. ID FR: {$id}\n",
FILE_APPEND
);
}
$financeDocument->path = FileHelper::storeFile($financeDocument, $sourceUrl);
if (!$this->replaceUrl($en)) {
$financeDocument->issuu_path = DocumentHelper::extractDocumentFromIssuIframe($en['post_content']);
$financeDocument->is_issuu = true;
}
$financeDocument->saveQuietly();
if (!$hasFrCats) {
$cats = $this->findCategoryByOldSlug($en, 'en');
$financeDocument->categories()->sync($cats);
}
if (!$hasFrTags) {
$tags = $this->findTagsByOldSlug($fr, 'en');
$financeDocument->tags()->sync($tags);
}
app()->setLocale('fr');
} else {
// ------------------------------
// 4) Cas : pas de traduction EN → log
// 5) Vérifier si langues inconnues
// ------------------------------
$id = isset($langs['fr']) ? $langs['fr']['ID'] : "inconnu";
file_put_contents(
$logFile,
"⚠️ Pas de traduction EN pour TRID $trid. ID FR: {$id}\n",
FILE_APPEND
);
}
// ------------------------------
// 5) Vérifier si langues inconnues
// ------------------------------
foreach ($langs as $langCode => $doc) {
if (!in_array($langCode, ['fr', 'en'])) {
foreach ($langs as $langCode => $doc) {
if (!in_array($langCode, ['fr', 'en'])) {
file_put_contents(
$logFile,
"⚠️ Langue inattendue '$langCode' pour TRID $trid. ID: {$doc['ID']}\n",
FILE_APPEND
);
file_put_contents(
$logFile,
"⚠️ Langue inattendue '$langCode' pour TRID $trid. ID: {$doc['ID']}\n",
FILE_APPEND
);
}
}
}
}
@ -218,7 +220,6 @@ return new class extends Migration
return null;
}
private function findCategoryByOldSlug(mixed $doc, string $locale): array
{
if (empty($doc['category_slugs'])) {
@ -272,8 +273,6 @@ return new class extends Migration
return null;
}
return collect(YearsEnum::cases())
->first(
fn(YearsEnum $year) =>
@ -281,7 +280,6 @@ return new class extends Migration
);
}
// SELECT
// p.ID,
// MAX(p.post_title) AS post_title,
@ -360,6 +358,8 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{

View file

@ -0,0 +1,312 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
{
Schema::table('companies', function (Blueprint $table) {
$table->id()->comment('Primary key of the company.')->change();
$table->timestamp('created_at')->nullable()->comment('Date on which the company was created.')->change();
$table->timestamp('updated_at')->nullable()->comment('Date on which the company was updated.')->change();
$table->timestamp('deleted_at')->nullable()->comment('Date on which the company was deleted.')->change();
});
Schema::table('company_activities', function (Blueprint $table) {
$table->id()->comment('Primary key of the company activity.')->change();
$table->timestamp('created_at')->nullable()->comment('Date on which the company activity was created.')->change();
$table->timestamp('updated_at')->nullable()->comment('Date on which the company activity was updated.')->change();
$table->timestamp('deleted_at')->nullable()->comment('Date on which the company activity was deleted.')->change();
});
Schema::table('company_sectors', function (Blueprint $table) {
$table->id()->comment('Primary key of the company sector.')->change();
$table->timestamp('created_at')->nullable()->comment('Date on which the company sector was created.')->change();
$table->timestamp('updated_at')->nullable()->comment('Date on which the company sector was updated.')->change();
$table->timestamp('deleted_at')->nullable()->comment('Date on which the company sector was deleted.')->change();
});
Schema::table('contact_counts', function (Blueprint $table) {
$table->id()->comment('Primary key of the counter.')->change();
$table->integer('submissions')->comment('Form submission counter.')->default(0)->change();
$table->unsignedTinyInteger('type')->comment('Contact form type.')->change();
$table->timestamp('created_at')->nullable()->comment('Date on which the counter was created.')->change();
$table->timestamp('updated_at')->nullable()->comment('Date on which the counter was updated.')->change();
});
Schema::table('documentables', function (Blueprint $table) {
$table->id()->comment('Primary key of the document relation.')->change();
$table->unsignedBigInteger('document_id')->comment('Primary key of the document.')->change();
$table->unsignedBigInteger('documentable_id')->comment('Primary key of the associated model.')->change();
$table->string('documentable_type')->comment('Model associated.')->change();
$table->timestamp('created_at')->nullable()->comment('Date on which the document relation was created.')->change();
$table->timestamp('updated_at')->nullable()->comment('Date on which the document relation was updated.')->change();
});
Schema::table('documents', function (Blueprint $table) {
$table->id()->comment('Primary key of the document.')->change();
$table->text('name')->comment('Name of the document.')->change();
$table->text('path')->nullable()->comment('Path of the document.')->after('name')->change();
$table->text('issuu_path')->nullable()->comment('Path of the issuu document.')->after('path')->change();
$table->unsignedTinyInteger('exercice')->nullable()->comment('Exercice of the document.')->change();
$table->unsignedTinyInteger('status')->comment('Status of the document.')->change();
$table->boolean('is_issuu')->default(false)->comment('Is an issuu document or not.')->change();
$table->timestamp('published_at')->nullable()->comment('Date on which the document relation was published.')->change();
$table->timestamp('unpublished_at')->nullable()->comment('Date on which the document relation was unpublished.')->change();
$table->timestamp('created_at')->nullable()->comment('Date on which the document relation was created.')->change();
$table->timestamp('updated_at')->nullable()->comment('Date on which the document relation was updated.')->change();
});
Schema::table('document_categories', function (Blueprint $table) {
$table->id()->comment('Primary key of the document category.')->change();
$table->text('name')->comment('Name of the document category.')->change();
$table->text('slug')->comment('Slug of the document category.')->change();
$table->timestamp('created_at')->nullable()->comment('Date on which the document category was created.')->change();
$table->timestamp('updated_at')->nullable()->comment('Date on which the document category was updated.')->change();
});
Schema::table('document_tags', function (Blueprint $table) {
$table->id()->comment('Primary key of the document tag.')->change();
$table->text('name')->comment('Name of the document tag.')->change();
$table->text('slug')->comment('Slug of the document tag.')->change();
$table->string('color')->default("#ff4e4e")->after('slug')->comment('Color of the document tag.')->change();
$table->timestamp('created_at')->nullable()->comment('Date on which the document tag was created.')->change();
$table->timestamp('updated_at')->nullable()->comment('Date on which the document tag was updated.')->change();
});
Schema::table('dynamic_pages', function (Blueprint $table) {
$table->id()->comment('Primary key of the dynamic page.')->change();
$table->string('id_key')->nullable()->comment('Unique identification key of the dynamic page.')->change();
$table->string('title')->comment('Title of the dynamic page.')->change();
$table->string('slug')->unique()->comment('Slug of the dynamic page.')->change();
$table->json('content')->nullable()->comment('Content of the dynamic page.')->change();
$table->unsignedBigInteger('config_id')->nullable()->comment('Associated configuration.')->change();
$table->unsignedBigInteger('page_id')->nullable()->comment('Associated page.')->change();
$table->unsignedTinyInteger('status')->comment('Status of the dynamic page.')->change();
$table->boolean('isLocked')->default(false)->comment('Locked status of the dynamic page.')->change();
$table->boolean('isRoot')->default(false)->comment('Root status of the dynamic page.')->change();
$table->timestamp('created_at')->nullable()->comment('Date on which the dynamic page was created.')->change();
$table->timestamp('updated_at')->nullable()->comment('Date on which the dynamic page was updated.')->change();
$table->timestamp('deleted_at')->nullable()->comment('Date on which the dynamic page was deleted.')->change();
});
Schema::table('news', function (Blueprint $table) {
$table->id()->comment('Primary key of the news.')->change();
$table->text('seo_title')->comment('SEO title of the news.')->change();
$table->text('seo_description')->comment('SEO description of the news.')->change();
$table->text('title')->comment('Title of the news.')->change();
$table->string('picture')->comment('Picture of the news.')->change();
$table->text('picture_alt')->comment('Alt attribute of the picture.')->change();
$table->text('picture_title')->comment('Title attribute of the picture.')->change();
$table->mediumText('content')->comment('Content of the news.')->change();
$table->boolean('inverted')->default(false)->comment('Position of the content.')->change();
$table->text('vimeo_id')->nullable()->comment('Vimeo id associated.')->change();
$table->unsignedTinyInteger('status')->comment('Status of the news.')->change();
$table->timestamp('published_at')->nullable()->comment('Date on which the news was published.')->change();
$table->timestamp('unpublished_at')->nullable()->comment('Date on which the news was unpublished.')->change();
$table->timestamp('created_at')->nullable()->comment('Date on which the news was created.')->change();
$table->timestamp('updated_at')->nullable()->comment('Date on which the news was updated.')->change();
$table->timestamp('deleted_at')->nullable()->comment('Date on which the news was deleted.')->after('updated_at')->change();
});
Schema::table('newsables', function (Blueprint $table) {
$table->id()->comment('Primary key of the news relation.')->change();
$table->unsignedBigInteger('news_id')->comment('Primary key of the news.')->change();
$table->unsignedBigInteger('newsable_id')->comment('Primary key of the associated model.')->change();
$table->string('newsable_type')->comment('Model associated.')->change();
$table->timestamp('created_at')->nullable()->comment('Date on which the news relation was created.')->change();
$table->timestamp('updated_at')->nullable()->comment('Date on which the news relation was updated.')->change();
});
Schema::table('news_categories', function (Blueprint $table) {
$table->id()->comment('Primary key of the news category.')->change();
$table->timestamp('created_at')->nullable()->comment('Date on which the news category was created.')->change();
$table->timestamp('updated_at')->nullable()->comment('Date on which the news category was updated.')->change();
$table->timestamp('deleted_at')->nullable()->comment('Date on which the news category was deleted.')->change();
});
Schema::table('news_tags', function (Blueprint $table) {
$table->id()->comment('Primary key of the news tag.')->change();
$table->timestamp('created_at')->nullable()->comment('Date on which the news tag was created.')->change();
$table->timestamp('updated_at')->nullable()->comment('Date on which the news tag was updated.')->change();
$table->timestamp('deleted_at')->nullable()->comment('Date on which the news tag was deleted.')->after('updated_at')->change();
});
Schema::table('page_configs', function (Blueprint $table) {
$table->id()->comment('Primary key of the configuration.')->change();
$table->string('label')->comment('Label of the configuration.')->change();
$table->string('view')->nullable()->comment('Specific view of the configuration.')->change();
$table->json('config')->comment('Structured data of the configuration.')->change();
$table->timestamp('created_at')->nullable()->comment('Date on which the configuration was created.')->change();
$table->timestamp('updated_at')->nullable()->comment('Date on which the configuration was updated.')->change();
$table->timestamp('deleted_at')->nullable()->comment('Date on which the configuration was deleted.')->change();
});
Schema::table('users', function (Blueprint $table) {
$table->id()->comment('Primary key of the user.')->change();
$table->timestamp('created_at')->nullable()->comment('Date on which the user was created.')->change();
$table->timestamp('updated_at')->nullable()->comment('Date on which the user was updated.')->change();
$table->timestamp('last_connection')->nullable()->comment('Date on which the user was connected.')->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
Schema::table('companies', function (Blueprint $table) {
$table->id()->change();
$table->timestamp('created_at')->nullable()->change();
$table->timestamp('updated_at')->nullable()->change();
$table->timestamp('deleted_at')->nullable()->change();
});
Schema::table('company_activities', function (Blueprint $table) {
$table->id()->change();
$table->timestamp('created_at')->nullable()->change();
$table->timestamp('updated_at')->nullable()->change();
$table->timestamp('deleted_at')->nullable()->change();
});
Schema::table('company_sectors', function (Blueprint $table) {
$table->id()->change();
$table->timestamp('created_at')->nullable()->change();
$table->timestamp('updated_at')->nullable()->change();
$table->timestamp('deleted_at')->nullable()->change();
});
Schema::table('contact_counts', function (Blueprint $table) {
$table->id()->change();
$table->integer('submissions')->comment('How many contact form have been submitted')->default(0)->change();
$table->unsignedTinyInteger('type')->comment('Enum du type de contact form')->change();
$table->timestamp('created_at')->nullable()->change();
$table->timestamp('updated_at')->nullable()->change();
});
Schema::table('documentables', function (Blueprint $table) {
$table->id()->change();
$table->unsignedBigInteger('document_id')->change();
$table->unsignedBigInteger('documentable_id')->change();
$table->string('documentable_type')->change();
$table->timestamp('created_at')->nullable()->change();
$table->timestamp('updated_at')->nullable()->change();
});
Schema::table('documents', function (Blueprint $table) {
$table->id()->change();
$table->text('name')->comment('Name of the file')->change();
$table->unsignedTinyInteger('exercice')->nullable()->change();
$table->unsignedTinyInteger('status')->comment('Status of the documents')->change();
$table->text('path')->nullable()->comment('Path of the file')->after('status')->change();
$table->boolean('is_issuu')->default(false)->comment('Is the document a Issuu preview')->change();
$table->text('issuu_path')->nullable()->comment('Path of the file in issuu')->after('is_issuu')->change();
$table->timestamp('published_at')->nullable()->comment('Document publishment date.')->change();
$table->timestamp('unpublished_at')->nullable()->comment('Document unpublishment date.')->change();
$table->timestamp('created_at')->nullable()->change();
$table->timestamp('updated_at')->nullable()->change();
});
Schema::table('document_categories', function (Blueprint $table) {
$table->id()->change();
$table->text('name')->comment('Name of the category')->change();
$table->text('slug')->comment('Slug of the category')->change();
$table->timestamp('created_at')->nullable()->change();
$table->timestamp('updated_at')->nullable()->change();
});
Schema::table('document_tags', function (Blueprint $table) {
$table->id()->change();
$table->text('name')->comment('Name of the tag')->change();
$table->text('slug')->comment('Slug of the tag')->change();
$table->string('color')->default("#ff4e4e")->after('slug')->comment('Color of the news category.')->change();
$table->timestamp('created_at')->nullable()->change();
$table->timestamp('updated_at')->nullable()->change();
});
Schema::table('dynamic_pages', function (Blueprint $table) {
$table->id()->change();
$table->string('id_key')->nullable()->comment('Page unique identification key.')->change();
$table->string('title')->comment('Page title.')->change();
$table->string('slug')->unique()->comment('Page slug.')->change();
$table->json('content')->nullable()->comment('Page content.')->change();
$table->unsignedBigInteger('config_id')->nullable()->comment('Page associated configuration.')->change();
$table->unsignedBigInteger('page_id')->nullable()->comment('Page associated page.')->change();
$table->unsignedTinyInteger('status')->comment('Page status.')->change();
$table->boolean('isLocked')->default(false)->comment('Page locked status.')->change();
$table->boolean('isRoot')->default(false)->comment('Page root status.')->change();
$table->timestamp('created_at')->nullable()->change();
$table->timestamp('updated_at')->nullable()->change();
$table->timestamp('deleted_at')->nullable()->change();
});
Schema::table('news', function (Blueprint $table) {
$table->id()->change();
$table->text('seo_title')->comment('News seo title.')->change();
$table->text('seo_description')->comment('News seo description.')->change();
$table->text('title')->comment('News title.')->change();
$table->string('picture')->comment('News picture.')->change();
$table->text('picture_alt')->comment('Picture alt attribute.')->change();
$table->text('picture_title')->comment('Picture title attribute.')->change();
$table->mediumText('content')->comment('News content.')->change();
$table->text('vimeo_id')->nullable()->comment('Vimeo id associated.')->change();
$table->unsignedTinyInteger('status')->comment('News status.')->change();
$table->boolean('inverted')->default(false)->comment('Content position.')->change();
$table->timestamp('published_at')->nullable()->comment('News corporate publishment date.')->change();
$table->timestamp('unpublished_at')->nullable()->comment('News corporate unpublishment date.')->change();
$table->timestamp('created_at')->nullable()->change();
$table->timestamp('updated_at')->nullable()->change();
$table->timestamp('deleted_at')->nullable()->after('unpublished_at')->change();
});
Schema::table('newsables', function (Blueprint $table) {
$table->id()->change();
$table->unsignedBigInteger('news_id')->change();
$table->unsignedBigInteger('newsable_id')->change();
$table->string('newsable_type')->change();
$table->timestamp('created_at')->nullable()->change();
$table->timestamp('updated_at')->nullable()->change();
});
Schema::table('news_categories', function (Blueprint $table) {
$table->id()->change();
$table->timestamp('created_at')->nullable()->change();
$table->timestamp('updated_at')->nullable()->change();
$table->timestamp('deleted_at')->nullable()->change();
});
Schema::table('news_tags', function (Blueprint $table) {
$table->id()->change();
$table->timestamp('created_at')->nullable()->change();
$table->timestamp('updated_at')->nullable()->change();
$table->timestamp('deleted_at')->nullable()->after('updated_at')->change();
});
Schema::table('page_configs', function (Blueprint $table) {
$table->id()->change();
$table->string('label')->comment('Configuration label.')->change();
$table->string('view')->nullable()->comment('Configuration view.')->change();
$table->json('config')->comment('Configuration details.')->change();
$table->timestamp('created_at')->nullable()->change();
$table->timestamp('updated_at')->nullable()->change();
$table->timestamp('deleted_at')->nullable()->change();
});
Schema::table('users', function (Blueprint $table) {
$table->id()->change();
$table->timestamp('created_at')->nullable()->change();
$table->timestamp('updated_at')->nullable()->change();
$table->timestamp('last_connection')->nullable()->change();
});
}
};