I think I may have suffered a migration regression for "phones". Migration from v.0.33 to v0.34
Hey All, I went through the path of updating from v.0.33 to v.0.34 and I'm experiencing some regression on the DB in the form of phones. Can somsone point me to the migrations files for the new phone structure and the migrations that were supposed to take place? Although I'll keep digging, I haven't been able to locate the migrations that changes the phones format and country code.
I'm currently getting the following error and it's broken my FE:
I can certainy create the column, but I'm also missing the others like phone.phonesPrimaryPhoeCountryCode. All of these columns are missing from my person schema. Super weird, and kinda scary.
37 Replies
Hi, did you check the files in
packages/twenty-server/src/database/commands/upgrade-version/0-34
?Hi, @ɃØĦɆᵾS - Yes, I'm actually in there poking around now.
GitHub
Build software better, together
GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 420 million projects.
Seems like the DB has dropped all of our phone numbers and reverted back to the old phone format. 😬
So now I'm just trying to dig that back up.
any idea what version it was when the phone format changed? v.0.32?
That's weird, what do you get if you run
select column_name from information_schema.columns where table_schema='{your_workspace}' and table_name='person';
?super weird.
lemme check
Just replace {your_workspace} 😉
yep
Just doing some double checking, but nothing returns.
This query returns nothing?
nope
🤔
So basically it shows that person table in your workspace is completely empty
oh! hold on
workspace_{workspace_id}
It returns 30 rows
Oh, it should looks something like this
select column_name from information_schema.columns where table_schema='workspace_1wgvd1injqtife6y4rvfbu3h5' and table_name='person';
Neat, could you send the result of your query?From what I can see, some records are cut
You don't have to worry you'll leak something, this query returns names of all columns of specified table
I think we're missing those other phone columns.
And also, you have some columns which I don't see on my end like
lifecycleStage
that might be a custom field.
Let me check it
Yes, it's custom.
You're right, I checked it on my end, when added new custom field, new column appeared
For reference, here are all columns, which should be in your database (assuming all fields created by default when setting up app are in place)
Awesome! Thank you. Any chance you can produce a schema export script? Although, I just don't want to mess with the ORM..
Are all of the above standard fields?
No, these are all default fields, which include both standard and custom fields
And about schema script, first of all, I'm not entirely sure if you should have all these columns as I'm on canary version, and second, messing with database is quite risky
100%
I'm going to revert back and see what happens.
Is there a command to check the state of the schema? When I run the migrations command it returns with no migrations to be made.
I'll probably add some disclaimer in docs for upgrading workspace to simply backup workspace before running upgrade script because almost every new release there are some bugs related to migration
Ha! That should be inherent .
As far as I know, sadly no
I did do a backup. I just figured the ORM would kick and scream on startup that the schema wasn't accurate.
It looks like phones became a problem prior to my 33.7
so I guess we've been operating with this issue for quite some time.
I take that back, but the other columns you have are certainly missing from mine:
This is from an older backup of 33.7
Ok, back to the most recent state of Twenty. This is what I did to get the app back up. (Highly not recommended to mess with the DB manually):
So is Twenty working right now? I'm sorry for delay
yes, all good. I'm just watching the logs looking for exceptions/etc
I did run a REINDEX here. All appears to be well. I don't see any errors.