Users Table: Changing Table Schema

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
mohal_04
Advanced
Posts: 108
Joined: 27 Mar 2018, 05:59

Users Table: Changing Table Schema

Post by mohal_04 » 10 Oct 2018, 17:05

Laravel: 5.6
Aimeos: 2018.07
PHP: 7.1.18

Hi,

I want to change unique index on email field in users table. So, I created a Schema file inside my extension. The name of the file is "customer.php" and it has the following lines of code:

Code: Select all


<?php

return array(
	'table' => array(
		'users' => function (\Doctrine\DBAL\Schema\Schema $schema) {
			$table = $schema->getTable('users');

    		        $table->dropIndex('unq_lvusr_email');
    		
    		        return $schema;
		}
	)
);

So, when I execute

Code: Select all

php artisan aimeos:setup
command. I get following error:
In SchemaException.php line 46:

There is no table with name 'public.users' in the schema.
So, what is going here? I have been doing the same thing for other tables.

Thanks!

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Users Table: Changing Table Schema

Post by aimeos » 10 Oct 2018, 17:59

The "users" table is a Laravel not managed by Aimeos. You have to use Laravel migrations to change the table but we would strongly recommend to keep the unique index on the email column!
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

mohal_04
Advanced
Posts: 108
Joined: 27 Mar 2018, 05:59

Re: Users Table: Changing Table Schema

Post by mohal_04 » 11 Oct 2018, 11:14

aimeos wrote:The "users" table is a Laravel not managed by Aimeos. You have to use Laravel migrations to change the table but we would strongly recommend to keep the unique index on the email column!
Hey, thanks for the help! Laravel migration file doesn't have all the fields for `users` table that I see in `users` table but Aimeos schema file have those fields. So, I thought that the migration is running from there.

Anyhow, thanks!

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Users Table: Changing Table Schema

Post by aimeos » 12 Oct 2018, 20:50

You are also right but it's not managed by the Aimeos Core and by the ai-laravel extension instead. Your own extension has to depend on 'ai-laravel' in the manifest.php of your extension so it's definition is available when you try to access it.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

mohal_04
Advanced
Posts: 108
Joined: 27 Mar 2018, 05:59

Re: Users Table: Changing Table Schema

Post by mohal_04 » 15 Oct 2018, 12:06

aimeos wrote:You are also right but it's not managed by the Aimeos Core and by the ai-laravel extension instead. Your own extension has to depend on 'ai-laravel' in the manifest.php of your extension so it's definition is available when you try to access it.
Hi,

Thanks again for your help! Each time I learn something new.

Thanks!

Post Reply