You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
calling php artisan migrate:refresh --seed after you've change a column or two (in this case I have changed sort_order to sort, because that's what I have in the config for spatie/eloquent-sortable) throws an error:
Seeding: Database\Seeders\PageSeeder
Illuminate\Database\QueryException SQLSTATE[42S22]: Column not found: 1054 Unknown column 'sort' in 'field list' (SQL: select max(`sort`) as aggregate from `pages` where `pages`.`deleted_at` is null)
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:692
688▕ // If an exception occurs when attempting to run a query, we'll format the error
689▕ // message to include the bindings with SQL, which will make this exception a
690▕ // lot more helpful to the developer instead of just the database's errors.
691▕ catch (Exception $e) { ➜ 692▕ throw new QueryException(
693▕ $query, $this->prepareBindings($bindings), $e
694▕ );
695▕ }
696▕
• A column was not found: You might have forgotten to run your migrations. You can run your migrations using `php artisan migrate`.
https://laravel.com/docs/master/migrations#running-migrations
+27 vendor frames
28 database/seeders/PageSeeder.php:18
Illuminate\Database\Eloquent\Model::__callStatic()
+7 vendor frames
36 database/seeders/DatabaseSeeder.php:24
Illuminate\Database\Seeder::call()
➜ megaplategit:(main) ✗ php artisan db
MariaDB [megaplate]> describe pages;
+------------+-----------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+-----------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| uri | varchar(255) | NO | | NULL | |
| slug | varchar(255) | NO | | NULL | |
| route | varchar(255) | NO | | NULL | |
| domain | varchar(255) | YES | MUL | NULL | |
| middleware | longtext | YES | | NULL | |
| title | longtext | NO | | NULL | |
| subtitle | longtext | YES | | NULL | |
| excerpt | longtext | YES | | NULL | |
| content | longtext | YES | | NULL | |
| view | varchar(255) | NO | | NULL | |
| is_active | tinyint(1) | NO | | 1 | |
| sort_order | mediumint(8) unsigned | NO | | 0 | |
| created_at | timestamp | YES | | NULL | |
| updated_at | timestamp | YES | | NULL | |
| deleted_at | timestamp | YES | | NULL | |
+------------+-----------------------+------+-----+---------+----------------+
16 rows in set (0.001 sec)
MariaDB [megaplate]> quit;
Bye➜ megaplategit:(main) ✗ cat database/migrations/rinvex/laravel-pages/2021_06_30_193226_create_pages_table.php
<?php
declare(strict_types=1);
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePagesTable extends Migration
{
/**
* The database schema.
*
* @var \Illuminate\Database\Schema\Builder
*/
protected $schema;
/**
* Create a new migration instance.
*
* @return void
*/
public function __construct()
{
$this->schema = Schema::connection($this->getConnection());
}
/**
* Get the migration connection name.
*
* @return string|null
*/
public function getConnection()
{
return config('database.default');
}
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
{
$this->schema->create(config('rinvex.pages.tables.pages'), function (Blueprint $table) {
// Columns
$table->increments('id');
$table->uuid('uuid');
$table->string('uri');
$table->string('slug');
$table->string('route');
$table->string('domain')->nullable();
$table->text('middleware')->nullable();
$table->text('title');
$table->text('subtitle')->nullable();
$table->text('excerpt')->nullable();
$table->text('content')->nullable();
$table->text('body');
$table->string('layout')->nullable();
$table->string('view');
$table->boolean('is_active')->default(true);
$table->mediumInteger('sort')->unsigned();
$table->text('meta')->nullable();
$table->unsignedBigInteger('created_by')->nullable();
$table->unsignedBigInteger('updated_by')->nullable();
$table->unsignedBigInteger('deleted_by')->nullable();
$table->timestamps();
$table->softDeletes();
// Indexes
$table->unique(['domain', 'uri']);
$table->unique(['domain', 'slug']);
$table->unique(['domain', 'route']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
$this->schema->dropIfExists(config('rinvex.pages.tables.pages'));
}
}
➜ megaplategit:(main) ✗ cat config/rinvex.pages.php
<?php
declare(strict_types=1);
return [
// Manage autoload migrations
'autoload_migrations' => true,
// Pageable Database Tables
'tables' => [
'pages' => 'pages',
'pageables' => 'pageables',
],
// Pageable Models
'models' => [
'page' => \Rinvex\Pages\Models\Page::class,
],
// Register routes
'register_routes' => true,
];
➜ megaplategit:(main) ✗
The text was updated successfully, but these errors were encountered:
calling
php artisan migrate:refresh --seed
after you've change a column or two (in this case I have changed sort_order to sort, because that's what I have in the config for spatie/eloquent-sortable) throws an error:Seeding: Database\Seeders\PageSeeder Illuminate\Database\QueryException SQLSTATE[42S22]: Column not found: 1054 Unknown column 'sort' in 'field list' (SQL: select max(`sort`) as aggregate from `pages` where `pages`.`deleted_at` is null) at vendor/laravel/framework/src/Illuminate/Database/Connection.php:692 688▕ // If an exception occurs when attempting to run a query, we'll format the error 689▕ // message to include the bindings with SQL, which will make this exception a 690▕ // lot more helpful to the developer instead of just the database's errors. 691▕ catch (Exception $e) { ➜ 692▕ throw new QueryException( 693▕ $query, $this->prepareBindings($bindings), $e 694▕ ); 695▕ } 696▕ • A column was not found: You might have forgotten to run your migrations. You can run your migrations using `php artisan migrate`. https://laravel.com/docs/master/migrations#running-migrations +27 vendor frames 28 database/seeders/PageSeeder.php:18 Illuminate\Database\Eloquent\Model::__callStatic() +7 vendor frames 36 database/seeders/DatabaseSeeder.php:24 Illuminate\Database\Seeder::call() ➜ megaplate git:(main) ✗ php artisan db MariaDB [megaplate]> describe pages; +------------+-----------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+-----------------------+------+-----+---------+----------------+ | id | int(10) unsigned | NO | PRI | NULL | auto_increment | | uri | varchar(255) | NO | | NULL | | | slug | varchar(255) | NO | | NULL | | | route | varchar(255) | NO | | NULL | | | domain | varchar(255) | YES | MUL | NULL | | | middleware | longtext | YES | | NULL | | | title | longtext | NO | | NULL | | | subtitle | longtext | YES | | NULL | | | excerpt | longtext | YES | | NULL | | | content | longtext | YES | | NULL | | | view | varchar(255) | NO | | NULL | | | is_active | tinyint(1) | NO | | 1 | | | sort_order | mediumint(8) unsigned | NO | | 0 | | | created_at | timestamp | YES | | NULL | | | updated_at | timestamp | YES | | NULL | | | deleted_at | timestamp | YES | | NULL | | +------------+-----------------------+------+-----+---------+----------------+ 16 rows in set (0.001 sec) MariaDB [megaplate]> quit; Bye ➜ megaplate git:(main) ✗ cat database/migrations/rinvex/laravel-pages/2021_06_30_193226_create_pages_table.php <?php declare(strict_types=1); use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreatePagesTable extends Migration { /** * The database schema. * * @var \Illuminate\Database\Schema\Builder */ protected $schema; /** * Create a new migration instance. * * @return void */ public function __construct() { $this->schema = Schema::connection($this->getConnection()); } /** * Get the migration connection name. * * @return string|null */ public function getConnection() { return config('database.default'); } /** * Run the migrations. * * @return void */ public function up(): void { $this->schema->create(config('rinvex.pages.tables.pages'), function (Blueprint $table) { // Columns $table->increments('id'); $table->uuid('uuid'); $table->string('uri'); $table->string('slug'); $table->string('route'); $table->string('domain')->nullable(); $table->text('middleware')->nullable(); $table->text('title'); $table->text('subtitle')->nullable(); $table->text('excerpt')->nullable(); $table->text('content')->nullable(); $table->text('body'); $table->string('layout')->nullable(); $table->string('view'); $table->boolean('is_active')->default(true); $table->mediumInteger('sort')->unsigned(); $table->text('meta')->nullable(); $table->unsignedBigInteger('created_by')->nullable(); $table->unsignedBigInteger('updated_by')->nullable(); $table->unsignedBigInteger('deleted_by')->nullable(); $table->timestamps(); $table->softDeletes(); // Indexes $table->unique(['domain', 'uri']); $table->unique(['domain', 'slug']); $table->unique(['domain', 'route']); }); } /** * Reverse the migrations. * * @return void */ public function down(): void { $this->schema->dropIfExists(config('rinvex.pages.tables.pages')); } } ➜ megaplate git:(main) ✗ cat config/rinvex.pages.php <?php declare(strict_types=1); return [ // Manage autoload migrations 'autoload_migrations' => true, // Pageable Database Tables 'tables' => [ 'pages' => 'pages', 'pageables' => 'pageables', ], // Pageable Models 'models' => [ 'page' => \Rinvex\Pages\Models\Page::class, ], // Register routes 'register_routes' => true, ]; ➜ megaplate git:(main) ✗
The text was updated successfully, but these errors were encountered: