Category : database-migration

I am aware of some potential solutions, but they all feel awful to me. In pipeline (github actions), run a one-off task on fargate to migrate DB before the deployments. Publish some kind of cloudformation event as a deploy hook and use it as a lambda trigger, and lambda will do the migration. Leverage laravel ..

Read more

So, I am trying to create a laravel project from scratch. I ran the following: composer global require "laravel/installer=~1.1" composer create-project laravel/laravel my-project-name php artisan serve Now I got the new laravel project ready to go, and tried to run: php artisan migrate but it returned an error: SQLSTATE[HY000] [2002] Connection refused I looked around ..

Read more

1) For add column to default user table: `php artisan make:migration add_column_delete_soft –table="user"`(if already migrate) -add above migration inside $table->SoftDeletes(); -if not migrate then follow this step: 1) add `$table->SoftDeletes()`; in create_user migration then follow below process as same. 2) Put in Model/User.php -put below package: use IlluminateDatabaseEloquentSoftDeletes; -add below line: use SoftDeletes; -Add below ..

Read more

just a question, which looks weird to me After successfully creating a database and my first table in my Postgres, unfortunately, when I run migration command the default migration-like users, failed jobs table not showing up but these 2 PHP files were shown under my migration folder and in public folder in my db Did ..

Read more

i’ve a migration like below public function up() { Schema::table(‘live_classes’, function (Blueprint $table) { $table->bigInteger(‘time’); }); } i wanted to change the datatype of the column time from bigInteger to date.i tried like below. public function up() { Schema::table(‘live_classes’, function (Blueprint $table) { $table->date(‘time’)->nullable()->change(); }); } This is not working.it shows the below error.How can ..

Read more

I try to do : php artisan make:model Lala -m but I receive the following line: **Model created successfully.** Created Migration: 2021_11_27_225646_create_lalas_table **SymfonyComponentProcessExceptionRuntimeException** A temporary file could not be opened to write the process output: fopen(C:UsersCARINE~1AppDataLocalTempsf_proc_00.out.lock): failed to open stream: Permission denied at C:laragonwwwwebappvendorsymfonyprocessPipesWindowsPipes.php:63 59▕ if (file_exists($file.’.lock’)) { 60▕ continue 2; 61▕ } 62▕ restore_error_handler(); ..

Read more

I don’t understand this, I alter my table to add these columns Schema::table(‘clusters’, function($table) { $table->string(‘ssaEnabled’,1)->default(‘0’); $table->string(‘ssaBackendUrl’)->default(NULL); $table->string(‘ssaPortalApiUrl’)->default(NULL); }); in my store() I have this $cluster->ssaEnabled = Input::get(‘ssaEnabled’,’0′); $cluster->ssaBackendUrl = Input::get(‘ssaBackendUrl’,”); $cluster->ssaPortalApiUrl = Input::get(‘ssaPortalApiUrl’,”); $cluster->save(); I kept getting prod.ERROR: SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "ssaBackendUrl" violates not-null constraint Why ?? ..

Read more

How do I make an id / primary key column that’s different from "id"? When I try it it creates an error. class CreateEmployeesTable extends Migration { // … public function up() { Schema::create(’employees’, function (Blueprint $table) { $table->id(’employee_id’); $table->string(‘first_name’, 100); $table->string(‘last_name’, 100); $table->string(’email’, 200); $table->timestamps(); }); } // … } Trying it out: php ..

Read more

Just made a new laravel project and tried to migrate the tables and i got this : SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = sugarDaddy and table_name = migrations and table_type = ‘BASE TABLE’) I tried clearing the cache, the routes, the config, and changing the DBHOST ..

Read more

I’m trying to switch my application to use Uuid, but my migration is failing on events table. SQLSTATE[42000]: Syntax error or access violation: 1068 Multiple primary key defined (SQL: alter table events add primary key events_id_primary(id)) Schema::create(‘events’, function (Blueprint $table) { $table->uuid(‘id’)->primary(); $table->string(‘title’, 255); $table->integer(‘join_id’, 6)->unique(); $table->string(‘image’)->nullable(); $table->string(‘location’)->nullable(); $table->text(‘description’)->nullable(); $table->timestamp(‘event_date’)->nullable(); $table->timestamp(‘event_time’)->nullable(); $table->foreignUuid(‘user_id’)->nullable()->index(); $table->foreign(‘user_id’) ->references(‘id’) ->on(‘users’) ..

Read more

I’m building a multi language website using Laravel. To do that I used the https://github.com/mcamara/laravel-localization package. Now I want to save the language as a field at users migrations. This is create_users_table.php: <?php use IlluminateDatabaseMigrationsMigration; use IlluminateDatabaseSchemaBlueprint; use IlluminateSupportFacadesSchema; class CreateUsersTable extends Migration { /** * Run the migrations. * * @return void */ public ..

Read more

when running "php artisan migrate:fresh" command it shows SQLSTATE[42000] error Here is the full error message SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘unsigned not null, created_at timestamp null, updated_at ..

Read more

Table QW has customised ID. I was trying to create a new QW with the id of ‘QWSE123’. It returns error as below SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘QWSE123’ for key ‘PRIMARY’ (SQL: insert into qw (id, updated_at, created_at) values (QWSE123, 2021-08-26 13:02:04, 2021-08-26 13:02:04)) migration Schema::create(‘qw’, function (Blueprint $table) { $table->string(‘id’, 26)->primary(); ..

Read more

I am using Laravel 8. I am trying to create a new table and this table does not exist in database and there are not any other table that has the same name. I did the migration and this is the migration code: <?php use IlluminateDatabaseMigrationsMigration; use IlluminateDatabaseSchemaBlueprint; use IlluminateSupportFacadesSchema; class CreateCertificateTable extends Migration { ..

Read more

I’m trying to run a Laravel migration which is failing at this line $table->dateTime(‘start_date’)->nullable()->default(‘0000-00-00 00:00:00′); And I’m getting the following error: 1067 Invalid default value for ‘start_date’ even after removing NO_ZERO_DATE and NO_ZERO_IN_DATE values from sql_mode. I’m using XAMPP, and I ran the following commands: SET GLOBAL sql_mode=” SET SESSION sql_mode=” SET sql_mode=” I also ..

Read more