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

Migration old albums from old 3.x to 4.x version #621

Closed
XMMM1 opened this issue Jun 17, 2020 · 5 comments
Closed

Migration old albums from old 3.x to 4.x version #621

XMMM1 opened this issue Jun 17, 2020 · 5 comments
Labels
bug Something isn't working

Comments

@XMMM1
Copy link

XMMM1 commented Jun 17, 2020

Hi,
i recently update my old Lychee version from 3.x to 4.0.6. I follow detaily to the migration guide described in documentation and everything went ok through. Although, my old albums were not migrated to new structure. Script says everything went ok, installation log has no errors written in it.

I also tried to run

php artisan migrate
and it says
Nothing to migrate.

I check the db, there was new tables created, but records in old ones were not migrated. Also prefix table was set in .env file as described.

Diagnostics
-------
Info: Latest version of PHP is 7.4
Warning: Using 32 bit PHP, recommended upgrade to 64 bit
Warning: Dropbox import not working. dropbox_key is empty.

System Information
--------------
Lychee Version (git):       master (c75811e) - Data not in Cache
DB Version:                 4.0.6

composer install:           --no-dev
APP_ENV:                    production
APP_DEBUG:                  false

System:                     Linux
PHP Version:                7.3
MySQL Version:              10.3.17-MariaDB-0+deb10u1

Imagick:                    1
Imagick Active:             1
Imagick Version:            1690
GD Version:                 2.2.5



Config Information
--------------
version:                    040006
check_for_updates:          0
sorting_Photos_col:         takestamp
sorting_Photos_order:       ASC
sorting_Albums_col:         max_takestamp
sorting_Albums_order:       ASC
imagick:                    1
skip_duplicates:            0
small_max_width:            0
small_max_height:           360
medium_max_width:           1920
medium_max_height:          1080
lang:                       en
layout:                     1
image_overlay:              1
image_overlay_type:         desc
default_license:            none
compression_quality:        90
full_photo:                 1
delete_imported:            0
Mod_Frame:                  1
Mod_Frame_refresh:          30
thumb_2x:                   1
small_2x:                   1
medium_2x:                  1
landing_page_enable:        0
landing_owner:              John Smith
landing_title:              John Smith
landing_subtitle:           Cats, Dogs & Humans Photography
landing_facebook:           https://www.facebook.com/JohnSmith
landing_flickr:             https://www.flickr.com/JohnSmith
landing_twitter:            https://www.twitter.com/JohnSmith
landing_instagram:          https://instagram.com/JohnSmith
landing_youtube:            https://www.youtube.com/JohnSmith
landing_background:         dist/cat.jpg
site_title:                 Lychee v4
site_copyright_enable:      1
site_copyright_begin:       2019
site_copyright_end:         2019
additional_footer_text:     
display_social_in_gallery:  0
public_search:              0
SL_enable:                  0
SL_for_admin:               0
public_recent:              0
recent_age:                 1
public_starred:             0
downloadable:               0
photos_wraparound:          1
map_display:                0
zip64:                      1
map_display_public:         0
map_provider:               Wikimedia
force_32bit_ids:            0
map_include_subalbums:      0
update_check_every_days:    3
has_exiftool:               0
share_button_visible:       0
import_via_symlink:         0
has_ffmpeg:                 0
location_decoding:          0
location_decoding_timeout:  30
location_show:              1
location_show_public:       0
rss_enable:                 0
rss_recent_days:            7
rss_max_items:              100
prefer_available_xmp_metadata: 0
editor_enabled:             1

System: RPI debian

Any further needed info can be provided.

@ildyria
Copy link
Member

ildyria commented Jun 17, 2020

I check the db, there was new tables created, but records in old ones were not migrated. Also prefix table was set in .env file as described.

It seems that the migration could not find the said v3 tables.

  • Are they on the same database?
  • default tables of lychee v3 are named likes lychee_albums, in that case you don't need a prefix.
    If they have prefix they will be prexif_lychee_albums, is this second case your set up?

You can still edit the .env to set or unset the prefix and then do php artisan refresh. This will erase the tables created by the migration and re-run the migration.

@ildyria ildyria added the More info required Issue which will be closed under 14 days if not replied by the author label Jun 17, 2020
@XMMM1
Copy link
Author

XMMM1 commented Jun 18, 2020

Hello,
yes database stays the same. The issue was that i set prefix, which was NOT needed (leave it empty). After that migration start to work; but I face some further problems:

In Connection.php line 671:

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (lyc hee.photos, CONSTRAINT photos_album_id_foreign FOREIGN KEY (album_id) REFERENCES albums (id) ON DELETE CASCADE) (
SQL: insert into photos (id, album_id, title, description, url, tags, public, type, width, height, si ze, iso, aperture, make, lens, model, shutter, focal, takestamp, star, thumbUrl, thumb2x, checksum,
medium, license, updated_at, created_at) values (1568982062, 1568960231, 16B87FA2-911D-45D3-8CA2-312E15, , 2f3eae83
76ce2a4952c56240826d7a5e.jpeg, , 0, image/jpeg, 4032, 3024, 3.2 MB, , , , , , , , ?, 0, 2f3eae8376ce2a4952c56240826d7a5e.jpe
g, 0, bbe4e9c294fc5db6392106e786a5b5947e9f7db1, , none, 2020-06-18 03:42:11, 2020-06-18 03:42:11))

In PDOStatement.php line 129:

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (lyc hee.photos, CONSTRAINT photos_album_id_foreign FOREIGN KEY (album_id) REFERENCES albums (id) ON DELETE CASCADE)

In PDOStatement.php line 127:

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (lyc hee.photos, CONSTRAINT photos_album_id_foreign FOREIGN KEY (album_id) REFERENCES albums (id) ON DELETE CASCADE)

I have 5 existing albums in it. It looks it tries to insert invalid data when migrating images to new table; specifically album_id which does not exist neither in old table or new one. Albums records were migrated ok to new table. All 5 records looks ok.

@ildyria
Copy link
Member

ildyria commented Jun 18, 2020

That is most likely because you are using a 32 bit architecture.

d7415 added a commit that referenced this issue Jun 18, 2020
d7415 added a commit that referenced this issue Jun 18, 2020
@ildyria ildyria added bug Something isn't working and removed More info required Issue which will be closed under 14 days if not replied by the author labels Jun 18, 2020
@ildyria
Copy link
Member

ildyria commented Jun 18, 2020

@XMMM1 please git pull and try again php artisan migrate:refresh. :)

@XMMM1
Copy link
Author

XMMM1 commented Jun 24, 2020

Hello, yes this was it.
32 bit architecture has nothing to do with migrations.. Even 4 records do not form 64bit long records id's in db.. Error message clearly shows issues with foreign key constraint..

Thanks for fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants