Skip to content

Commit ac650eb

Browse files
committed
- fix: have error while create user (MySql)
1 parent c19b983 commit ac650eb

File tree

5 files changed

+34
-67
lines changed

5 files changed

+34
-67
lines changed

database/migrations/create_inspire-cms-core_table.php.stub

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ return new class extends BaseMigration
88
{
99
public function up()
1010
{
11-
$tableNames = $this->getTableNames();
11+
$tableNames = $this->getCmsTableNames();
1212

1313
Schema::create($tableNames['content'], function (Blueprint $table) {
1414
$table->uuid('id')->primary();
@@ -224,7 +224,7 @@ return new class extends BaseMigration
224224

225225
public function down()
226226
{
227-
$tableNames = $this->getTableNames();
227+
$tableNames = $this->getCmsTableNames();
228228

229229
Schema::dropIfExists($tableNames['key_value']);
230230

@@ -251,29 +251,4 @@ return new class extends BaseMigration
251251
Schema::dropIfExists($tableNames['content_path']);
252252
Schema::dropIfExists($tableNames['content']);
253253
}
254-
255-
private function getTableNames()
256-
{
257-
return [
258-
'field_groupable' => $this->prefix . 'field_groupables',
259-
'content_version' => $this->prefix . 'content_versions',
260-
'content_publish_version' => $this->prefix . 'content_publish_version',
261-
'content_path' => $this->prefix . 'content_paths',
262-
'content_route' => $this->prefix . 'content_routes',
263-
'content' => $this->prefix . 'content',
264-
'content_lock' => $this->prefix . 'content_locks',
265-
'document_type' => $this->prefix . 'document_types',
266-
'document_type_inheritance' => $this->prefix . 'document_type_inheritance',
267-
'allowed_document_type' => $this->prefix . 'document_type_allowed_document_type',
268-
'language' => $this->prefix . 'languages',
269-
'user_login_activity' => $this->prefix . 'user_login_activities',
270-
'user' => $this->prefix . 'users',
271-
'template' => $this->prefix . 'templates',
272-
'templatable' => $this->prefix . 'templateable',
273-
'content_web_setting' => $this->prefix . 'content_web_settings',
274-
'sitemap' => $this->prefix . 'sitemaps',
275-
'navigation' => $this->prefix . 'navigation',
276-
'key_value' => $this->prefix . 'key_values',
277-
];
278-
}
279254
};

database/migrations/create_inspire-cms-import_and_export_table.php.stub

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ return new class extends BaseMigration
88
{
99
public function up()
1010
{
11-
$tableNames = $this->getTableNames();
11+
$tableNames = $this->getCmsTableNames();
1212

1313
Schema::create($tableNames['import'], function (Blueprint $table) {
1414
$table->uuid('id')->primary();
@@ -45,18 +45,10 @@ return new class extends BaseMigration
4545

4646
public function down()
4747
{
48-
$tableNames = $this->getTableNames();
48+
$tableNames = $this->getCmsTableNames();
4949

5050

5151
Schema::dropIfExists($tableNames['export']);
5252
Schema::dropIfExists($tableNames['import']);
5353
}
54-
55-
private function getTableNames()
56-
{
57-
return [
58-
'import' => $this->prefix . 'imports',
59-
'export' => $this->prefix . 'exports',
60-
];
61-
}
6254
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
use Illuminate\Database\Schema\Blueprint;
4+
use Illuminate\Support\Facades\DB;
5+
use Illuminate\Support\Facades\Schema;
6+
use Illuminate\Support\Str;
7+
use SolutionForest\InspireCms\InspireCmsConfig;
8+
use SolutionForest\InspireCms\Support\Base\BaseMigration;
9+
10+
return new class extends BaseMigration
11+
{
12+
/**
13+
* Run the migrations.
14+
*/
15+
public function up(): void
16+
{
17+
$tableNames = $this->getCmsTableNames();
18+
Schema::table($tableNames['user'], function (Blueprint $table) {
19+
$table->bigIncrements('id')->change();
20+
});
21+
}
22+
};

database/migrations/update_inspirecms-cms-users_table.php.stub

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ return new class extends BaseMigration
1414
*/
1515
public function up(): void
1616
{
17-
$tableNames = $this->getTableNames();
17+
$tableNames = $this->getCmsTableNames();
1818
$spatiePermissionTableNames = config('permission.table_names');
1919
$cmsUserMorphType = app(InspireCmsConfig::getUserModelClass())->getMorphClass();
2020

@@ -79,6 +79,11 @@ return new class extends BaseMigration
7979
$table->index('uuid');
8080
$table->unique('email');
8181
});
82+
83+
// 5. Confirm bigIncrements
84+
Schema::table($tableNames['user'], function (Blueprint $table) {
85+
$table->bigIncrements('id')->change();
86+
});
8287

8388
//endregion Update cms user table
8489

@@ -159,7 +164,7 @@ return new class extends BaseMigration
159164

160165
public function down(): void
161166
{
162-
$tableNames = $this->getTableNames();
167+
$tableNames = $this->getCmsTableNames();
163168
$spatiePermissionTableNames = config('permission.table_names');
164169
$cmsUserMorphType = app(InspireCmsConfig::getUserModelClass())->getMorphClass();
165170

@@ -301,32 +306,4 @@ return new class extends BaseMigration
301306
//endregion Rollback 'cms_users' changes
302307

303308
}
304-
305-
private function getTableNames()
306-
{
307-
return [
308-
'field_groupable' => $this->prefix . 'field_groupables',
309-
'content_version' => $this->prefix . 'content_versions',
310-
'content_publish_version' => $this->prefix . 'content_publish_version',
311-
'content_path' => $this->prefix . 'content_paths',
312-
'content_route' => $this->prefix . 'content_routes',
313-
'content' => $this->prefix . 'content',
314-
'content_lock' => $this->prefix . 'content_locks',
315-
'document_type' => $this->prefix . 'document_types',
316-
'document_type_inheritance' => $this->prefix . 'document_type_inheritance',
317-
'allowed_document_type' => $this->prefix . 'document_type_allowed_document_type',
318-
'language' => $this->prefix . 'languages',
319-
'user_login_activity' => $this->prefix . 'user_login_activities',
320-
'user' => $this->prefix . 'users',
321-
'template' => $this->prefix . 'templates',
322-
'templatable' => $this->prefix . 'templateable',
323-
'content_web_setting' => $this->prefix . 'content_web_settings',
324-
'sitemap' => $this->prefix . 'sitemaps',
325-
'navigation' => $this->prefix . 'navigation',
326-
'key_value' => $this->prefix . 'key_values',
327-
'media_asset' => $this->prefix . 'media_assets',
328-
'import' => $this->prefix . 'imports',
329-
'export' => $this->prefix . 'exports',
330-
];
331-
}
332309
};

src/InspireCmsServiceProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ protected function getMigrations(): array
281281
'create_custom_spatie_permission_table', // uuid enhac
282282
'update_sessions_table', // uuid enhance
283283
'update_inspirecms-cms-users_table',
284+
'hotfix_inspirecms_users_table',
284285
];
285286
}
286287

0 commit comments

Comments
 (0)