BRACKETS-by-TRIAD / craftable

Admin panel builder / CRUD generator for Laravel.
https://getcraftable.com
MIT License
984 stars 191 forks source link

Base table or view not found: 1146 Table 'testblog.permissions' doesn't exist #419

Closed chrismeats closed 1 year ago

chrismeats commented 1 year ago

I am attempting to install craftable using --no-sail and am getting this error message.

It seems that there is no migration for creating the permissions table? Below is the output of craftable install --no-sail

Crafting Craftable :) ...
Info from https://repo.packagist.org: #StandWithUkraine
Using version ^8.0 for brackets/craftable
./composer.json has been updated
Running composer update brackets/craftable
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   INFO  Discovering packages.  

  brackets/admin-auth ........................................................................................................... DONE
  brackets/admin-generator ...................................................................................................... DONE
  brackets/admin-listing ........................................................................................................ DONE
  brackets/admin-translations ................................................................................................... DONE
  brackets/admin-ui ............................................................................................................. DONE
  brackets/advanced-logger ...................................................................................................... DONE
  brackets/craftable ............................................................................................................ DONE
  brackets/media ................................................................................................................ DONE
  brackets/translatable ......................................................................................................... DONE
  intervention/image ............................................................................................................ DONE
  laravel/legacy-factories ...................................................................................................... DONE
  laravel/sail .................................................................................................................. DONE
  laravel/sanctum ............................................................................................................... DONE
  laravel/tinker ................................................................................................................ DONE
  maatwebsite/excel ............................................................................................................. DONE
  nesbot/carbon ................................................................................................................. DONE
  nunomaduro/collision .......................................................................................................... DONE
  nunomaduro/termwind ........................................................................................................... DONE
  spatie/laravel-backup ......................................................................................................... DONE
  spatie/laravel-ignition ....................................................................................................... DONE
  spatie/laravel-medialibrary ................................................................................................... DONE
  spatie/laravel-permission ..................................................................................................... DONE
  spatie/laravel-signal-aware-command ........................................................................................... DONE
  spatie/laravel-translatable ................................................................................................... DONE

99 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> @php artisan vendor:publish --tag=laravel-assets --ansi --force

   INFO  No publishable resources for tag [laravel-assets].  

Info from https://repo.packagist.org: #StandWithUkraine
Using version ^6.2 for brackets/admin-generator
./composer.json has been updated
Running composer update brackets/admin-generator
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   INFO  Discovering packages.  

  brackets/admin-auth ........................................................................................................... DONE
  brackets/admin-generator ...................................................................................................... DONE
  brackets/admin-listing ........................................................................................................ DONE
  brackets/admin-translations ................................................................................................... DONE
  brackets/admin-ui ............................................................................................................. DONE
  brackets/advanced-logger ...................................................................................................... DONE
  brackets/craftable ............................................................................................................ DONE
  brackets/media ................................................................................................................ DONE
  brackets/translatable ......................................................................................................... DONE
  intervention/image ............................................................................................................ DONE
  laravel/legacy-factories ...................................................................................................... DONE
  laravel/sail .................................................................................................................. DONE
  laravel/sanctum ............................................................................................................... DONE
  laravel/tinker ................................................................................................................ DONE
  maatwebsite/excel ............................................................................................................. DONE
  nesbot/carbon ................................................................................................................. DONE
  nunomaduro/collision .......................................................................................................... DONE
  nunomaduro/termwind ........................................................................................................... DONE
  spatie/laravel-backup ......................................................................................................... DONE
  spatie/laravel-ignition ....................................................................................................... DONE
  spatie/laravel-medialibrary ................................................................................................... DONE
  spatie/laravel-permission ..................................................................................................... DONE
  spatie/laravel-signal-aware-command ........................................................................................... DONE
  spatie/laravel-translatable ................................................................................................... DONE

99 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> @php artisan vendor:publish --tag=laravel-assets --ansi --force

   INFO  No publishable resources for tag [laravel-assets].  

Testing the database connection...
...connection OK
Installing Craftable...
   INFO  No publishable resources for tag [migrations].  

   INFO  No publishable resources for tag [config].  

   INFO  Publishing assets.  

  Copying file [vendor/spatie/laravel-backup/config/backup.php] to [config/backup.php] .......................................... DONE
  Copying directory [vendor/spatie/laravel-backup/resources/lang] to [lang/vendor/backup] ....................................... DONE

   INFO  Publishing [migrations] assets.  

  Copying file [vendor/spatie/laravel-medialibrary/database/migrations/create_media_table.php.stub] to [database/migrations/2023_02_07_123814_create_media_table.php]  DONE

   INFO  Publishing assets.  

  Copying file [vendor/brackets/media/install-stubs/config/media-collections.php] to [config/media-collections.php] ............. DONE

   INFO  Publishing assets.  

  Copying file [vendor/brackets/advanced-logger/config/advanced-logger.php] to [config/advanced-logger.php] ..................... DONE

   INFO  Publishing assets.  

  Copying file [vendor/brackets/craftable/install-stubs/database/migrations/fill_default_admin_user_and_permissions.php] to [database/migrations/2023_02_07_123819_fill_default_admin_user_and_permissions.php]  DONE
  Copying file [vendor/brackets/craftable/resources/images/avatar.png] to [storage/images/avatar.png] ........................... DONE

Installing package brackets/admin-ui
Changing package.json
package.json changed
   INFO  Publishing assets.  

  Copying directory [vendor/brackets/admin-ui/install-stubs/resources/js/admin] to [resources/js/admin] ......................... DONE
  Copying directory [vendor/brackets/admin-ui/install-stubs/resources/sass/admin] to [resources/sass/admin] ..................... DONE
  Copying directory [vendor/brackets/admin-ui/install-stubs/resources/views] to [resources/views] ............................... DONE
  Copying file [vendor/brackets/admin-ui/install-stubs/config/wysiwyg-media.php] to [config/wysiwyg-media.php] .................. DONE
  Copying file [vendor/brackets/admin-ui/install-stubs/webpack.mix.js] to [webpack.mix.js] ...................................... DONE
  Copying file [vendor/brackets/admin-ui/install-stubs/database/migrations/create_wysiwyg_media_table.php] to [database/migrations/2018_07_18_000000_create_wysiwyg_media_table.php]  DONE

Package brackets/admin-ui installed
Installing package brackets/admin-auth
   INFO  Publishing assets.  

  Copying file [vendor/brackets/admin-auth/install-stubs/config/admin-auth.php] to [config/admin-auth.php] ...................... DONE
  Copying file [vendor/brackets/admin-auth/install-stubs/database/migrations/create_admin_activations_table.php] to [database/migrations/2017_08_24_000000_create_admin_activations_table.php]  DONE
  Copying file [vendor/brackets/admin-auth/install-stubs/database/migrations/create_admin_password_resets_table.php] to [database/migrations/2017_08_24_000000_create_admin_password_resets_table.php]  DONE
  Copying file [vendor/brackets/admin-auth/install-stubs/database/migrations/create_admin_users_table.php] to [database/migrations/2017_08_24_000000_create_admin_users_table.php]  DONE
  Copying file [vendor/brackets/admin-auth/install-stubs/database/migrations/add_last_login_at_timestamp_to_admin_users_table.php] to [database/migrations/2020_10_21_000000_add_last_login_at_timestamp_to_admin_users_table.php]  DONE
  Copying directory [vendor/brackets/admin-auth/install-stubs/resources/lang] to [resources/lang/vendor/admin-auth] ............. DONE

   INFO  Publishing assets.  

  Copying file [vendor/brackets/admin-auth/install-stubs/config/activation.php] to [config/activation.php] ...................... DONE
  Copying file [vendor/brackets/admin-auth/install-stubs/database/migrations/create_activations_table.php] to [database/migrations/2017_08_24_000000_create_activations_table.php]  DONE

   INFO  Preparing database.  

  Creating migration table ................................................................................................. 70ms DONE

   INFO  Running migrations.  

  2014_10_12_000000_create_users_table ..................................................................................... 33ms DONE
  2014_10_12_100000_create_password_resets_table ........................................................................... 31ms DONE
  2017_08_24_000000_create_activations_table ............................................................................... 22ms DONE
  2017_08_24_000000_create_admin_activations_table ........................................................................ 107ms DONE
  2017_08_24_000000_create_admin_password_resets_table ..................................................................... 48ms DONE
  2017_08_24_000000_create_admin_users_table ............................................................................... 26ms DONE
  2018_07_18_000000_create_wysiwyg_media_table ............................................................................. 17ms DONE
  2019_08_19_000000_create_failed_jobs_table ............................................................................... 19ms DONE
  2019_12_14_000001_create_personal_access_tokens_table .................................................................... 24ms DONE
  2020_10_21_000000_add_last_login_at_timestamp_to_admin_users_table ........................................................ 7ms DONE
  2023_02_07_123814_create_media_table ..................................................................................... 34ms DONE
  2023_02_07_123819_fill_default_admin_user_and_permissions ................................................................ 43ms FAIL

In Connection.php line 760:

  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'testblog.permissions' doesn't exist (SQL: select * from `permissions` wh  
  ere (`name` = admin and `guard_name` = admin) limit 1)                                                                               

In Exception.php line 18:

  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'testblog.permissions' doesn't exist  

In PDOConnection.php line 82:

  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'testblog.permissions' doesn't exist  

Aborted.
gegejosper commented 1 year ago

same issue here...

palypster commented 1 year ago

Can you verify Craftable was installed with package spatie/laravel-permission version 5.9.1 and not 5.9.0? It might be related to this: https://github.com/spatie/laravel-permission/releases/tag/5.9.1

chrismeats commented 1 year ago

I do not see where spatie/laravel-permission was installed at all! Was there another command I was supposed to run?

I just tried installing that using composer require spatie/laravel-permission I confirmed it installed using v 5.9.1 but still get the same error when running craftable install --no-sail It seems there was still no migration or anything created for a permissions table.

I followed the spatie permissions setup instructions and publish the migrations using php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" I then ran the permissions migration using php artisan migrate --path=database/migrations/2023_02_08_153701_create_permission_tables.php After that I was able to get craftable installed.

Doesnt seems like all these extra steps should be necessary so Im not sure what I did during the setup but this got it to work.

I also realized I had an old version of node, not sure if that caused some of these issues.

palypster commented 1 year ago

No no, no extra steps are required. Craftabkle actually requires spatie/laravel-permission so it should have been installed by default. And it most likely was installed (although you're saying the opposite), look at your ouput, there is a line: spatie/laravel-permission ..................................................................................................... DONE

But maybe they've changed something, the way it should be installed. We'll have to look into it more deeply.

palypster commented 1 year ago

Yep, they've changed the installation: https://github.com/spatie/laravel-permission/pull/2301

Okay, PR with fix on the way: https://github.com/BRACKETS-by-TRIAD/craftable/pull/420

will be merged and released today

palypster commented 1 year ago

Fixed. Can you confirm?

gegejosper commented 1 year ago

I tried reinstalling but still not working... still error exist