Page 1 of 1

Users Table: Changing Table Schema

Posted: 10 Oct 2018, 17:05
by mohal_04
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!

Re: Users Table: Changing Table Schema

Posted: 10 Oct 2018, 17:59
by aimeos
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!

Re: Users Table: Changing Table Schema

Posted: 11 Oct 2018, 11:14
by mohal_04
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!

Re: Users Table: Changing Table Schema

Posted: 12 Oct 2018, 20:50
by aimeos
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.

Re: Users Table: Changing Table Schema

Posted: 15 Oct 2018, 12:06
by mohal_04
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!