lundi 1 août 2016

Laravel migration with SQLite

Hello i have migration in Postgres and SQLite, I am facing problem with SQLite database. Same migrations are for 2 diffrent database. Postgres migration is OK, but SQlite not good. I added migration for altering table and adding new field.

   public function up()
    {
        Schema::table('retailer_products_photo_fix', function ($table) {

            $table->integer('currency_id')->unsigned();
            $table->foreign('currency_id')->references('id')->on('currency')
               ->onUpdate('cascade')->onDelete('cascade');

           $table->dropColumn('currency');
        });


    }

but i got error

General error: 1 Cannot add a NOT NULL column with default value NULL

When i try to add nullable() field isn't created and when i add default value 0 or 1 i got constraint error because i related table i have rows 1 and 2. What to do?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire