Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with migration. "setup_role_permissions #74

Closed
jbarraathena opened this issue Sep 18, 2019 · 3 comments
Closed

Problem with migration. "setup_role_permissions #74

jbarraathena opened this issue Sep 18, 2019 · 3 comments

Comments

@jbarraathena
Copy link

Following the first steps I have a problem when doing the first migration

After doing: php artisan migrate --seed

I'm using SQL Server. Some tables are created succesfully but in the step "setup_role_permissions" I receive the following error:


PS C:\path\laravue> php artisan migrate:fresh --seed
Dropped all tables successfully.
Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated:  2014_10_12_000000_create_users_table
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated:  2014_10_12_100000_create_password_resets_table
Migrating: 2019_03_16_102314_add_simple_role_to_user_table
Migrated:  2019_03_16_102314_add_simple_role_to_user_table
Migrating: 2019_04_20_125200_create_permission_tables
Migrated:  2019_04_20_125200_create_permission_tables
Migrating: 2019_04_20_130706_setup_role_permissions

   Illuminate\Database\QueryException  : SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The object 'DF__users__role__20C1E124' is dependent on column 'role'. (SQL: alter table "users" drop column "role")

  at C:\path\laravue\vendor\laravel\framework\src\Illuminate\Database\Connection.php:664
    660|         // If an exception occurs when attempting to run a query, we'll format the error
    661|         // message to include the bindings with SQL, which will make this exception a
    662|         // lot more helpful to the developer instead of just the database's errors.
    663|         catch (Exception $e) {
  > 664|             throw new QueryException(
    665|                 $query, $this->prepareBindings($bindings), $e
    666|             );
    667|         }
    668|

  Exception trace:

  1   PDOException::("SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The object 'DF__users__role__20C1E124' is dependent on column 'role'.")
      C:\path\laravue\vendor\laravel\framework\src\Illuminate\Database\Connection.php:458

  2   PDOStatement::execute()
      C:\path\laravue\vendor\laravel\framework\src\Illuminate\Database\Connection.php:458

  Please use the argument -v to see more details.
@tuandm
Copy link
Owner

tuandm commented Sep 24, 2019

Hi @jbarraathena,

I don't use SQL Server for developing Laravue, but from the error there is a constraint adding to users table (users.role) which shouldn't.

In this migration https://github.com/tuandm/laravue/blob/master/database/migrations/2019_03_16_102314_add_simple_role_to_user_table.php, the role column is added without constraint. Please help to double check your database config to figure out how that constraint is added.

@fendipratama
Copy link

how to fix it?
i use SQL Server too for developing laravue, and i have some problem like this

@tuandm
Copy link
Owner

tuandm commented Jan 7, 2020

@jbarraathena, @fendipratama
We don't have enough resource to check on Windows/SQL Server, instead, we've added docker support in 0.8.0 version. Please try it out.

@tuandm tuandm closed this as completed Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants