rinvex / laravel-attributes

⚠️ [ABANDONED] Rinvex Attributable is a robust, intelligent, and integrated Entity-Attribute-Value model (EAV) implementation for Laravel Eloquent, with powerful underlying for managing entity attributes implicitly as relations with ease. It utilizes the power of Laravel Eloquent, with smooth and seamless integration.
MIT License
434 stars 104 forks source link

Migration Autoload Issue #111

Closed tgrantmartin closed 4 years ago

tgrantmartin commented 4 years ago

I noticed that following the addition of the migration autoload feature, my project attempted to run the migrations from the package rather than my locally published, and in my case, already migrated, migrations. This resulted in an error when running artisan migrate in which the migrations to create the tables were run against a database that already had the tables present.

The resultant error is below: "Migrating: 2020_01_01_000001_create_attributes_table

Illuminate\Database\QueryException : SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'attributes' already exists (SQL: create table attributes (id int unsigned not null auto_increment primary key, slug varchar(255) not null, name json not null, description json null, sort_order mediumint unsigned not null default '0', group varchar(255) null, type varchar(255) not null, is_required tinyint(1) not null default '0', is_collection tinyint(1) not null default '0', default text null, created_at timestamp null, updated_at timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')"

Solution: Add the following line to the register method of your AppsServiceProvider: app('config')->set('rinvex.attributes.autoload_migrations',false);

tgrantmartin commented 4 years ago

I recommend adding this to the documentation.

Omranic commented 4 years ago

That's not the right way to do it, you can simply disable this feature using config option rinvex.attributes.autoload_migrations

If you published your assets, then just disable that option here config/rinvex.attributes.php