-
-
Notifications
You must be signed in to change notification settings - Fork 132
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
Error on reset-tasks : Data too long for column 'uuid' at row 1 #789
Comments
That's a very strange error. The tubesync/tubesync/sync/management/commands/reset-tasks.py Lines 20 to 33 in 7e86e23
What does the schema of your database look like?? |
Schema:
I enabled mysql logs and this is the query that fails:
Is is saving the UUID with the "-" . If I check what is in the DB it's without the "-" : 0b01f2d57a0e42b787e64cf8db664a5a |
That's very helpful. Thanks! I tracked down the difference. Your database is marked as having a native I would have thought the migrate would alter the table for this, but that doesn't appear to have happened. The Django folks apparently punted on trying to automate this... Change the " The example SQL given when that type was added: ALTER TABLE `sync_source` MODIFY COLUMN `uuid` UUID NOT NULL; More about the UUID data type: |
This is a fresh installation from days ago btw, I guess one of the migrations did not do the job.
Gives error
This is what I had to run to be able to change
Now reset-tasks worked with no issue. Thanks! |
I'm glad it's working for you. That on delete for the foreign key isn't shown for my tables. I setup a MariaDB container just today to test some issues. Here are the tables the migration created: CREATE TABLE `sync_media` (
`uuid` uuid NOT NULL,
`created` datetime(6) NOT NULL,
`published` datetime(6) DEFAULT NULL,
`key` varchar(100) NOT NULL,
`thumb` varchar(200) DEFAULT NULL,
`thumb_width` smallint(5) unsigned DEFAULT NULL CHECK (`thumb_width` >= 0),
`thumb_height` smallint(5) unsigned DEFAULT NULL CHECK (`thumb_height` >= 0),
`metadata` longtext DEFAULT NULL,
`can_download` tinyint(1) NOT NULL,
`media_file` varchar(255) DEFAULT NULL,
`skip` tinyint(1) NOT NULL,
`downloaded` tinyint(1) NOT NULL,
`download_date` datetime(6) DEFAULT NULL,
`downloaded_format` varchar(30) DEFAULT NULL,
`downloaded_height` int(10) unsigned DEFAULT NULL CHECK (`downloaded_height` >= 0),
`downloaded_width` int(10) unsigned DEFAULT NULL CHECK (`downloaded_width` >= 0),
`downloaded_audio_codec` varchar(30) DEFAULT NULL,
`downloaded_video_codec` varchar(30) DEFAULT NULL,
`downloaded_container` varchar(30) DEFAULT NULL,
`downloaded_fps` smallint(5) unsigned DEFAULT NULL CHECK (`downloaded_fps` >= 0),
`downloaded_hdr` tinyint(1) NOT NULL,
`downloaded_filesize` bigint(20) unsigned DEFAULT NULL CHECK (`downloaded_filesize` >= 0),
`source_id` uuid NOT NULL,
`manual_skip` tinyint(1) NOT NULL,
`title` varchar(200) NOT NULL,
`duration` int(10) unsigned DEFAULT NULL CHECK (`duration` >= 0),
PRIMARY KEY (`uuid`),
UNIQUE KEY `sync_media_source_id_key_fcc78d4f_uniq` (`source_id`,`key`),
KEY `sync_media_created_61f7b0af` (`created`),
KEY `sync_media_published_7a195efa` (`published`),
KEY `sync_media_key_86e7766a` (`key`),
KEY `sync_media_can_download_0ef818f1` (`can_download`),
KEY `sync_media_skip_7ced4cb6` (`skip`),
KEY `sync_media_downloaded_bc18c4aa` (`downloaded`),
KEY `sync_media_download_date_02604c5f` (`download_date`),
KEY `sync_media_downloaded_filesize_e6028d20` (`downloaded_filesize`),
KEY `sync_media_manual_skip_dd66e16d` (`manual_skip`),
CONSTRAINT `sync_media_source_id_36827e1d_fk_sync_source_uuid` FOREIGN KEY (`source_id`) REFERENCES `sync_source` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci ;
CREATE TABLE `sync_source` (
`uuid` uuid NOT NULL,
`created` datetime(6) NOT NULL,
`last_crawl` datetime(6) DEFAULT NULL,
`source_type` varchar(1) NOT NULL,
`key` varchar(100) NOT NULL,
`name` varchar(100) NOT NULL,
`directory` varchar(100) NOT NULL,
`index_schedule` int(11) NOT NULL,
`delete_old_media` tinyint(1) NOT NULL,
`days_to_keep` smallint(5) unsigned NOT NULL CHECK (`days_to_keep` >= 0),
`source_resolution` varchar(8) NOT NULL,
`source_vcodec` varchar(8) NOT NULL,
`source_acodec` varchar(8) NOT NULL,
`prefer_60fps` tinyint(1) NOT NULL,
`prefer_hdr` tinyint(1) NOT NULL,
`fallback` varchar(1) NOT NULL,
`has_failed` tinyint(1) NOT NULL,
`copy_thumbnails` tinyint(1) NOT NULL,
`media_format` varchar(200) NOT NULL,
`write_nfo` tinyint(1) NOT NULL,
`download_cap` int(11) NOT NULL,
`download_media` tinyint(1) NOT NULL,
`write_json` tinyint(1) NOT NULL,
`embed_metadata` tinyint(1) NOT NULL,
`embed_thumbnail` tinyint(1) NOT NULL,
`enable_sponsorblock` tinyint(1) NOT NULL,
`sponsorblock_categories` varchar(128) NOT NULL,
`write_subtitles` tinyint(1) NOT NULL,
`auto_subtitles` tinyint(1) NOT NULL,
`sub_langs` varchar(30) NOT NULL,
`delete_removed_media` tinyint(1) NOT NULL,
`filter_text` varchar(200) NOT NULL,
`copy_channel_images` tinyint(1) NOT NULL,
`delete_files_on_disk` tinyint(1) NOT NULL,
`filter_seconds` int(10) unsigned DEFAULT NULL CHECK (`filter_seconds` >= 0),
`filter_seconds_min` tinyint(1) NOT NULL,
`filter_text_invert` tinyint(1) NOT NULL,
`index_videos` tinyint(1) NOT NULL,
`index_streams` tinyint(1) NOT NULL,
PRIMARY KEY (`uuid`),
UNIQUE KEY `key` (`key`),
UNIQUE KEY `name` (`name`),
UNIQUE KEY `directory` (`directory`),
KEY `sync_source_created_8079497f` (`created`),
KEY `sync_source_last_crawl_958645b9` (`last_crawl`),
KEY `sync_source_source_type_710adae4` (`source_type`),
KEY `sync_source_index_schedule_67161c8b` (`index_schedule`),
KEY `sync_source_source_resolution_9ef82fdf` (`source_resolution`),
KEY `sync_source_source_vcodec_9329d58f` (`source_vcodec`),
KEY `sync_source_source_acodec_25060130` (`source_acodec`),
KEY `sync_source_fallback_b73936ab` (`fallback`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci ;
|
Yeah my bad, I just created the default that I could think of.
|
So, the final set of statements was: ALTER TABLE `sync_media`
DROP FOREIGN KEY `sync_media_source_id_36827e1d_fk_sync_source_uuid`;
ALTER TABLE `sync_media`
MODIFY COLUMN `uuid` UUID NOT NULL;
ALTER TABLE `sync_media`
MODIFY COLUMN `source_id` UUID NOT NULL;
ALTER TABLE `sync_source`
MODIFY COLUMN `uuid` UUID NOT NULL;
ALTER TABLE `sync_media`
ADD CONSTRAINT `sync_media_source_id_36827e1d_fk_sync_source_uuid`
FOREIGN KEY (`source_id`) REFERENCES `sync_source` (`uuid`);
|
I actually didn't ran
This is because it was still working since on this table it is a char(36)
Running now there was error because there were duplicated keys. |
Hmm. I wonder how that one column was larger... " Please close this issue when you're finished. |
I'm getting this error when running:
python3 manage.py reset-tasks
The text was updated successfully, but these errors were encountered: