migrate data from entry/bundlers? #3

Closed
opened 2024-03-10 00:25:57 +00:00 by ewof · 1 comment

is this possible and if so how

is this possible and if so how
Owner

Technically it's possible, the schema is essentially the same with the only difference really being column names and 1 or 2 extras.

image
image

Depending on the number of pastes you're migrating this could be pretty easy or pretty hard.

Pastes would have to be re-rendered and have that value filled into the content_html column (from new schema), and GroupSubmitPassword would have to just be dropped entirely.

Metadata would also likely have to be dropped as many of the fields are different now.

Honestly you could likely just import all data and run the following SQL commands (untested, so you should probably review them):

ALTER TABLE "Pastes" CHANGE "CustomURL" "custom_url" VARCHAR(1000000);
ALTER TABLE "Pastes" CHANGE "GroupName" "group_name" VARCHAR(1000000);
ALTER TABLE "Pastes" CHANGE "PubDate" "pub_date" VARCHAR(1000000);
ALTER TABLE "Pastes" CHANGE "EditDate" "edit_date" VARCHAR(1000000);
ALTER TABLE "Pastes" CHANGE "EditPassword" "edit_password" VARCHAR(1000000);
ALTER TABLE "Pastes" CHANGE "Metadata" "metadata" VARCHAR(1000000);

Then you can just set the value of metadata to the default for all pastes (fix deserialization error):

{"owner":"","private_source":"off","title":"","description":"","favicon":null,"embed_color":"#ff9999"}

You'll also have to add the id column. This column normally has a random value, but you could technically set it to be the same as the custom_url and you'll have no issues.

*Technically* it's possible, the schema is essentially the same with the only difference really being column names and 1 or 2 extras. ![image](/attachments/f45875fd-2758-42c3-8c49-748e6482535d) ![image](/attachments/ef469c61-79d7-4923-ad92-e31df9fba883) Depending on the number of pastes you're migrating this could be pretty easy or pretty hard. Pastes would have to be re-rendered and have that value filled into the `content_html` column (from new schema), and `GroupSubmitPassword` would have to just be dropped entirely. `Metadata` would also likely have to be dropped as many of the [fields](https://stellular.net/api/docs/bundlrs/db/bundlesdb/struct.PasteMetadata.html) are different now. Honestly you could likely just import all data and run the following SQL commands (untested, so you should probably review them): ```sql ALTER TABLE "Pastes" CHANGE "CustomURL" "custom_url" VARCHAR(1000000); ALTER TABLE "Pastes" CHANGE "GroupName" "group_name" VARCHAR(1000000); ALTER TABLE "Pastes" CHANGE "PubDate" "pub_date" VARCHAR(1000000); ALTER TABLE "Pastes" CHANGE "EditDate" "edit_date" VARCHAR(1000000); ALTER TABLE "Pastes" CHANGE "EditPassword" "edit_password" VARCHAR(1000000); ALTER TABLE "Pastes" CHANGE "Metadata" "metadata" VARCHAR(1000000); ``` Then you can just set the value of `metadata` to the default for all pastes (fix deserialization error): ```json {"owner":"","private_source":"off","title":"","description":"","favicon":null,"embed_color":"#ff9999"} ``` You'll also have to add the `id` column. This column normally has a random value, but you could technically set it to be the same as the `custom_url` and you'll have no issues.
hkau added the
question
label 2024-03-10 02:52:20 +00:00
hkau closed this issue 2024-04-29 00:12:00 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: stellular/bundlrs#3
No description provided.