-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
Migration table not found error in SQL Server despite existence of migrations table when running migrate command #50842
Comments
Thank you for reporting this issue! As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub. If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team. Thank you! |
Sorry, I could only reproduce it once but not anymore. Please put |
Your schema is not actually called |
And what is the value of |
@staudenmeir |
How did you make the custom schema work with Laravel (since there is no config option for it)? Did you set it as the default schema for the database user? |
As @staudenmeir said, there is no config option for setting default schema when using SQL Server connection. So it's hardcoded to 'migrations' => 'sample.migrations', // as your default schema is `sample` Or using new Laravel 11 options: 'migrations' => [
'table' => 'sample.migrations', // as your default schema is `sample`
'update_date_on_publish' => true,
], |
Thank you for your response! I've confirmed that adding the following code works without any issues! 'migrations' => [
'table' => 'sample.migrations',
], Is there any plan to support the traditional behavior in the future? |
@hafezdivandari
My apologies for the oversight. In previous versions of Laravel, I was able to use a custom schema by executing SQL statements like the following: CREATE LOGIN [sample] WITH PASSWORD = 'sample';
CREATE SCHEMA [sample];
CREATE USER [sample] FOR LOGIN [sample];
ALTER USER [sample] WITH DEFAULT_SCHEMA = [sample];
GRANT CREATE TABLE TO [sample];
GRANT SELECT ON SCHEMA::role TO [sample];
GRANT SELECT, INSERT, UPDATE, DELETE, REFERENCES, ALTER ON SCHEMA::sample TO [sample];
GRANT CREATE TABLE TO [sample];
GRANT ALTER ON SCHEMA::sample TO [sample];
Does this align with your intended answer? |
Can you please add some details ? |
Laravel Version
11.1.0
PHP Version
8.2.17
Database Driver & Version
SQL Server 2022
Description
I am in the process of upgrading Laravel from version 10 to 11 for a project that uses SQLServer as the database. In Laravel 10, after executing
php artisan migrate command
, the migrations table is successfully created, and runningphp artisan migrate:status
yields the expected output.However, after upgrading to Laravel 11, while the
php artisan migrate command
still creates the migrations table as expected, runningphp artisan migrate:status
results in an error message statingERROR Migration table not found.
This issue arises despite the fact that the migrations table does indeed exist in the SQLServer database, as confirmed through manual inspection.
This behavior is inconsistent with the expected outcome and differs from the results in Laravel 10 under the same conditions. It suggests there might be an issue with how the migration status command interacts with the SQLServer database in Laravel 11, specifically in recognizing the existence of the migrations table.
I am looking for guidance on resolving this error and understanding whether this is a known issue with a workaround or a newly introduced bug in Laravel 11.
Steps To Reproduce
php artisan migrate
to initialize the database schemas, including the creation of the migrations table in your SQLServer database.php artisan migrate:status
to assess the migration status. Despite the migrations table clearly existing in the SQLServer database, this command unexpectedly results in an error statingERROR Migration table not found.
The text was updated successfully, but these errors were encountered: