-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
2023_01_21_225350_add_eol_date_on_assets_table - migration fails to add eol_explicit column #13723
Comments
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. |
What's the result of the migration through? |
The migration never completed, because of the error. It attempts to set a default value of 0 for eol_explicit, but fails because the column was never added. |
I have the same problem. This was to output while migrationg:
|
I have found a workaround. First update from v6.0.2 to v6.1.1 and then to v6.2.2. The migrations will then apply succesfully. |
I am having the exact same issue. Here is the output of
@snipe I am using Thanks |
I have manually checked out the v6.1.1 tag.
After that I have reseted the git repo to HEAD and run |
I think @spencerrlongg figured out what the issue is - he should hopefully have a fix out soon. In the meantime, incremental updates are the workaround. |
We see what's happening here and why now - it's just a tough problem to solve for future-proofing. The issue here is that we added some code to the asset observer to dynamically determine whether the EOL date was explicitly added (i.e. by picking one via the date picker or API) versus the EOL date that gets auto calculated based on the model/warranty information we already have. It's failing on that old migration because that code in the observer fires any time we save the asset, and when that earlier migration fires, we do save the asset: snipe-it/database/migrations/2023_01_21_225350_add_eol_date_on_assets_table.php Lines 30 to 33 in 2a9ed09
which triggers the snipe-it/app/Observers/AssetObserver.php Lines 132 to 145 in 2a9ed09
When that fires, the We either have to muck back-in-time with the migrations to create a temp field and then drop it later, before we actually add it in the later migration, or we have to junk up the asset observer forever to check if that field exists yet. Both of these choices are terrible, but we're figuring out which one will be the least awful. :( |
I have a PR up for this (#13748) that will hopefully resolve this issue moving forward. |
Debug mode
Describe the bug
I am migrating my install to a new server and upgrading from SnipeIT v6.0.2 to v6.2.2. After installing SnipeIT and restoring my database backup, running php artisan migrate results in the following error:
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'eol_explicit' in 'field list' in [Snipe-IT Install directory]\vendor\laravel\framework\src\Illuminate\Database\Connection.php:522
The migration that is failing is
2023_01_21_225350_add_eol_date_on_assets_table
Reproduction steps
Expected behavior
php artisan migrate should update the database schema with any changes made since previous version was installed.
Screenshots
No response
Snipe-IT Version
6.2.2
Operating System
Windows Server 2022
Web Server
IIS
PHP Version
8.0.30
Operating System
No response
Browser
No response
Version
No response
Device
No response
Operating System
No response
Browser
No response
Version
No response
Error messages
No response
Additional context
I'm migrating our SnipeIT data to a new server. This is a fresh install of 6.2.2 on a new server, however I'm restoring a backup of our database from when we were on 6.0.2.
What I've done so far:
I have not manually edited any data directly in the database.
Downgrading to version 6.2.1 resolves the issue. I followed the steps described above and did not experience any errors after downgrading.
The text was updated successfully, but these errors were encountered: