Bom dia, eu estou com dúvidas sobre o migrate, criei 2 tabelas, categorias e produtos
public function up()
{
Schema::create('categorias', function (Blueprint $table) {
$table->bigIncrements('id');
$table->name('nome');
$table->timestamps();
});
}
public function up()
{
Schema::create('produtos', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('categoria_id');
$table->string('nome');
$table->string('descricao');
$table->decimal('preco', 8, 2);
$table->timestamps();
$table->foreignId('categoria_id')
->references('id')
->on('categorias');
});
}
Mas ao rodar o migrate gerou este erro abaixo:
Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table (0.18 seconds)
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table (0.22 seconds)
Migrating: 2020_04_25_032035_criar_tabela_produtos
BadMethodCallException : Method Illuminate\Database\Schema\Blueprint::foreignId does not exist.
at /home/grasiela/projetos/estoque-de-produtos/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php:104
100| */
101| public function __call($method, $parameters)
102| {
103| if (! static::hasMacro($method)) {
> 104| throw new BadMethodCallException(sprintf(
105| 'Method %s::%s does not exist.', static::class, $method
106| ));
107| }
108|
Exception trace:
1 Illuminate\Database\Schema\Blueprint::__call("foreignId")
/home/grasiela/projetos/estoque-de-produtos/database/migrations/2020_04_25_032035_criar_tabela_produtos.php:24
2 CriarTabelaProdutos::{closure}(Object(Illuminate\Database\Schema\Blueprint))
/home/grasiela/projetos/estoque-de-produtos/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php:166
Please use the argument -v to see more details.
Whoops\Exception\ErrorException : PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: /usr/lib/php/20170718/pdo_sqlite (/usr/lib/php/20170718/pdo_sqlite: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pdo_sqlite.so (/usr/lib/php/20170718/pdo_sqlite.so: undefined symbol: php_pdo_unregister_driver))
at Unknown:0
1|
Exception trace:
1 Whoops\Run::handleError("PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: /usr/lib/php/20170718/pdo_sqlite (/usr/lib/php/20170718/pdo_sqlite: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pdo_sqlite.so (/usr/lib/php/20170718/pdo_sqlite.so: undefined symbol: php_pdo_unregister_driver))", "Unknown")
/home/grasiela/projetos/estoque-de-produtos/vendor/filp/whoops/src/Whoops/Run.php:408
2 Whoops\Run::handleShutdown()
[internal]:0
Como faço para resolver?