laravel-migrations

Can't start Laravel, I get “Base table or view not found” error

我只是一个虾纸丫 提交于 2020-12-29 09:57:18
问题 First I rolled back 2 migrations by mistake, then I ran php artisan migrate command and I got the following error: [Illuminate\Database\QueryException] SQLSTATE[42S02]: Base table or view not found: 1146 Table 'exercise1.categories' doesn't exist (SQL: select * from categories where parent_id = 0) [PDOException] SQLSTATE[42S02]: Base table or view not found: 1146 Table 'exercise1.categories' doesn't exist Then I stopped Laravel. After that when I run the php artisan serve command for starting

Can't start Laravel, I get “Base table or view not found” error

北城以北 提交于 2020-12-29 09:56:57
问题 First I rolled back 2 migrations by mistake, then I ran php artisan migrate command and I got the following error: [Illuminate\Database\QueryException] SQLSTATE[42S02]: Base table or view not found: 1146 Table 'exercise1.categories' doesn't exist (SQL: select * from categories where parent_id = 0) [PDOException] SQLSTATE[42S02]: Base table or view not found: 1146 Table 'exercise1.categories' doesn't exist Then I stopped Laravel. After that when I run the php artisan serve command for starting

Laravel move data from one table to another and drop the column that the data came from?

♀尐吖头ヾ 提交于 2020-02-04 21:41:28
问题 I'm trying to do the following process in a Laravel migration: Create a new table called client_log_partitions . (DONE) $table->create(); $table->bigIncrements('id')->unique(); $table->bigInteger('client_log_id'); $table->mediumText('partition_data'); $table->timestamps(); I already have a table called client_logs with data stored in a bigText() column called log_data . Each row that already exists in the client_logs table needs to be split every 250 KB (or 250,000 characters since it should

How to fix foreign key error when running migration

放肆的年华 提交于 2020-01-22 02:31:08
问题 I don't know why it's still don't work and show this: Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 1005 Can't create table db_rocnikovka . books (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table books add constraint books_doba_foreign foreign key ( doba ) references druh_knihies ( id_druhu )) at C:\xampp\htdocs\Rocnikovka\vendor\laravel\framework\src\Illuminate\Database\Connection.php:665 Exception trace: 1 PDOException::("SQLSTATE[HY000]:

Laravel migrations change a column type from varchar to longText

China☆狼群 提交于 2019-12-21 03:18:13
问题 I need to change with migration column type of $table->string('text'); to a text type, I have tried to do that in few ways, but none of them worked. Is it possible to do it in one migration. I could I guess drop the column and then create it again with new type, but I wonder if it is possible to do it in one migration? 回答1: You can create a new migration and change just one column type: public function up() { Schema::table('sometable', function (Blueprint $table) { $table->text('text')-

Laravel 5.1 Migration and Seeding Cannot truncate a table referenced in a foreign key constraint

谁都会走 提交于 2019-12-18 12:52:28
问题 I'm trying to run the migration (see below) and seed the database, but when I run php artisan migrate --seed I get this error: Migration table created successfully. Migrated: 2015_06_17_100000_create_users_table Migrated: 2015_06_17_200000_create_password_resets_table Migrated: 2015_06_17_300000_create_vehicles_table [Illuminate\Database\QueryException] SQLSTATE[42000]: Syntax error or access violation: 1701 Cannot truncate a table referenced in a foreign key constraint (`app`.`vehicles`,

naming tables in many to many relationships laravel

≡放荡痞女 提交于 2019-12-18 03:02:00
问题 I concerned about auto naming tables in many-to-many Laravel relationship. for example: Schema::create('feature_product', function (Blueprint $table) { when change the table name to: Schema::create('product_feature', function (Blueprint $table) { I have an error in my relationship. What's the matter with product_feature ? 回答1: Laravel's naming convention for pivot tables is snake_cased model names in alphabetical order separated by an underscore. So, if one model is Feature , and the other

Subclassing Migrator not working for namespaced migration

断了今生、忘了曾经 提交于 2019-12-14 02:38:50
问题 I have some namespaced migrations, and I can't get past the Class Not Found errors due to namespacing. In an earlier question, Antonio Carlos Ribeiro stated: Laravel migrator doesn't play nice with namespaced migrations. Your best bet in this case is to subclass and substitute the Migrator class, like Christopher Pitt explains in his blog post: https://medium.com/laravel-4/6e75f99cdb0. I have tried doing so (followed by composer dump-autoload , of course), but am continuing to receive Class

Laravel 5.1 migration new table not working

主宰稳场 提交于 2019-12-13 05:21:57
问题 I have got some problem with migration. I create new migrate file php artisan make:migration create_menu_table --create=menu then i edit the new Migration file and when i try migrate it's not working I tried: php artisan migrate php artisan migrate --force php artisan migrate:refresh php artisan migrate:refresh --seed php artisan migrate:rollback php artisan migrate:reset but they do not add created table I do not have any errors Thanks for help 回答1: Run composer dumpautoload and then try php

Laravel migration “Cannot add foreign key constraint” error with MySQL database

人盡茶涼 提交于 2019-12-13 03:27:42
问题 I am developing a Laravel application. I am using MySQL for the database. I have created a model class and am trying to run the migration on it. But when, I run migration, I am getting error with adding the foreign key constraint. This is what I have done so far. First I have migrated the built in Laravel user model running this command. php artisan migrate The users table was created in the database. Then I created another model running this command. php artisan make:model TodoItem -m Then I