Базовая таблица или просмотр не найдены Таблица «tenancy.websites» не найдена - PullRequest
0 голосов
/ 31 октября 2018

После того, как я установил многопользовательский пакет hyn и запустил php artisan tenancy:migrate, я получаю сообщение об ошибке «базовая таблица не найдена». Команда должна мигрировать три миграции. Первое существо 2017_01_01_000003_tenancy_websites.php. Вот содержание ...

<?php

class TenancyWebsites extends AbstractMigration
{
    protected $system = true;

    public function up()
    {
        Schema::create('websites', function (Blueprint $table) {
            $table->bigIncrements('id');

            $table->string('uuid');

            $table->timestamps();
            $table->softDeletes();
        });
    }

    public function down()
    {
        Schema::dropIfExists('websites');
    }
}

Тогда 2017_01_01_000005_tenancy_hostnames.php. Вот содержание ...

<?php

class TenancyHostnames extends AbstractMigration
{
    protected $system = true;

    public function up()
    {
        Schema::create('hostnames', function (Blueprint $table) {
            $table->bigIncrements('id');

            $table->string('fqdn')->unique();
            $table->string('redirect_to')->nullable();
            $table->boolean('force_https')->default(false);
            $table->timestamp('under_maintenance_since')->nullable();
            $table->bigInteger('website_id')->unsigned()->nullable();

            $table->timestamps();
            $table->softDeletes();

            $table->foreign('website_id')->references('id')->on('websites')->onDelete('set null');
        });
    }

    public function down()
    {
        Schema::dropIfExists('hostnames');
    }
}

Тогда 2017_01_01_000003_tenancy_hostnames.php. Вот содержание ...

class TenancyWebsitesNeedsDbHost extends AbstractMigration
{
    protected $system = true;

    public function up()
    {
        Schema::table('websites', function (Blueprint $table) {
            $table->string('managed_by_database_connection')
                ->nullable()
                ->comment('References the database connection key in your database.php');
        });
    }

    public function down()
    {
        Schema::table('websites', function (Blueprint $table) {
            $table->dropColumn('managed_by_database_connection');
        });
    }
}

Я выполнил все шаги в их документации. Что не так с кодом?

1 Ответ

0 голосов
/ 31 октября 2018

Ничего в коде ... это имена файлов, которые не отсортированы правильно. порядок выполнения основан на имени файла это ваш заказ

  1. 2017_01_01_000003_tenancy_hostnames.php
  2. 2017_01_01_000003_tenancy_websites.php
  3. 2017_01_01_000005_tenancy_hostnames.php

правильный порядок должен быть (имя с тем же именем класса содержится)

  1. 2017_01_01_000003_TenancyWebsites.php
  2. 2017_01_01_000005_TenancyHostnames.php
  3. 2017_01_01_000007_TenancyWebsitesNeedsDbHost.php
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...