-2
I have a project where I made some Migrations, but when I did I managed to run the Migrations quietly. I recently formatted my computer, installed Postgressql and did my "Restore" from my DB. In that I downloaded my project again and so I went to give php artisan migrate
appeared the following error.
In Connection.php line 664:
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "qusuario.tu_permissao" does not exist
LINE 1: select * from "qusuario"."tu_permissao"
^ (SQL: select * from "qusuario"."tu_permissao")
In Connection.php line 330:
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "qusuario.tu_permissao" does not exist
LINE 1: select * from "qusuario"."tu_permissao"
In that I tried to change the orders of Migrations, I tried to create the table "tu_permissao" as it says in the error, but when I created and I php artisan migrate
he returned to me that the table already exists.
My migrate
:
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTuPermissaosTable extends Migration
{
public function up()
{
Schema::create('qusuario.tu_permissao', function (Blueprint $table) {
$table->bigIncrements('mid');
$table->string('nome', 60);
$table->string('mdesc', 120);
});
}
public function down()
{
Schema::dropIfExists('qusuario.tu_permissao');
}
}
Order of migrations
:
Why is one being executed
SELECT
in the bank when themigrate
?– Woss
@Woss, I’m not sure, I suppose it’s part of
migrate
, but this error occurs as soon as I do thephp artisan migrate
– mnegri_dev
qusuario
is the name give what? From the bank? How far do I know this is set up in.env
orconfig/database.php
and not in Migration itself, if the intention is to use point as prefix, I think it is already wrong, or at least disturbing Migration, since the point is used for specific things in querys. If the dot is just prefix even change all by_
everywhere referring to the table name– Guilherme Nascimento
@Guilhermenascimento, the bank is already set up, my doubt is why I can’t perform the
migrate
– mnegri_dev
Database is one thing, table is another, if Migration generates the tables then being configured doesn’t make sense, unless you don’t know the difference, if the tables already exist in the database and you did them manually and it doesn’t make sense to use Migration. Otherwise pay attention to what I have already said and I am repeating, the
.
there in theSchema::create('qusuario.tu_permissao'
does not seem to make sense, unless you want to force create a table in a specific bank, if that is the case then it is configuring wrong and probably (I can’t say) is disturbing the logic of Migration.– Guilherme Nascimento
@Guilhermenascimento my database was configured with various Schemas, so the
Schema::create('qusuario.tu_permissao')
– mnegri_dev
But the
migrates
before thetu_permissao
works normally, so I have no idea what.– mnegri_dev
As I have already said, I am almost certain that you imagine that it works with point to separate, but it does not work. As far as I know, but I could be wrong. At least perhaps not expected by the eloquent/eloquent
– Guilherme Nascimento
@Guilhermenascimento The System has been online for 11 years, I think it has been a while that works with the
.
, but as I said my doubt is not whether my bank is configured correctly, why have I done severalmigrations
, but that one this specific error occurred– mnegri_dev
And you’re running some Seed? Because if the select is generated by Migration or Seed it is expecting something wrong and on top of that in a moment it separates
"foo"."bar"
and in the other he joins"foo.bar"
, as if it was just the table name using quotes.– Guilherme Nascimento
The strangest thing is that you claim that the system has been online for 11 years, and Laravel is only 8 years old, that is, before it was done in a way and certainly not with Laravel’s Migrations
– Guilherme Nascimento
@Guilhermenascimento worse than no, I do not execute any
seed
.– mnegri_dev
@Guilhermenascimento I’m talking about the bank, the system used to run with
CodeIgniter
, based on theLaravel
and henceforth this normal functioning. Minemigrations
, mineseeders
, run normally, only the one in question that gave this specific error.– mnegri_dev
Never mind, do with Migration and do without Migration (before) are two different things, something clearly was set wrong, I do not know if it is possible to set the bank directly in Scheme::create, as far as I know you create a connection for each bank and say this before create for each Migration. The only other possibility, if Laravel accepts to set the database directly in the string, would be if its postgres user is not allowed to create tables in the database
qusuario
– Guilherme Nascimento
@Guilhermenascimento good thanks for trying to help, I will continue my tests here and any resolution, I return with the same in the post. :)
– mnegri_dev