# |
Oct 3rd 2018, 14:55 |
btx |
i would definitely avoid truncating tables, that’d be data you’d then have to recreate. and technically if you could recreate it programmatically then you could also have figured out the FK programmatically in the first place. If there are multiple options and it’s not possible to determine the right one AND it’s important to know the right one, then you could do a “MIGRATIONS-20181003” record in the related table and then go back and |
# |
Oct 3rd 2018, 14:55 |
ricksaccous |
might be the best solution at this point, since no client data exists anyway |
# |
Oct 3rd 2018, 14:54 |
ricksaccous |
and i'll refactor the migrations |
# |
Oct 3rd 2018, 14:54 |
ricksaccous |
related to this |
# |
Oct 3rd 2018, 14:54 |
ricksaccous |
so delete all tables |
# |
Oct 3rd 2018, 14:54 |
ricksaccous |
for this thing |
# |
Oct 3rd 2018, 14:54 |
ricksaccous |
I'm going to squash migrations |
# |
Oct 3rd 2018, 14:54 |
ricksaccous |
honestly i could probably just tell my fellow devs |
# |
Oct 3rd 2018, 14:53 |
ricksaccous |
but it's set automatically via site operated on when creating the record |
# |
Oct 3rd 2018, 14:52 |
ricksaccous |
by other options selected you could guess the user's site |
# |
Oct 3rd 2018, 14:52 |
ricksaccous |
it's linking to the user's site |
# |
Oct 3rd 2018, 14:52 |
btx |
what is it tracking? |
# |
Oct 3rd 2018, 14:52 |
btx |
yeah I should have asked that, what is the column linking to? |
# |
Oct 3rd 2018, 14:51 |
ricksaccous |
in a way the field is actually used to SOMEWHAT track which user created it |
# |
Oct 3rd 2018, 14:51 |
ricksaccous |
it's set for them |
# |
Oct 3rd 2018, 14:51 |
ricksaccous |
but they do when they create it |
# |
Oct 3rd 2018, 14:51 |
ricksaccous |
they don't manually pick |
# |
Oct 3rd 2018, 14:51 |
ricksaccous |
user kind of picks one in a sense |
# |
Oct 3rd 2018, 14:50 |
btx |
and it would be up to the user to pick one? or should it be programmatically determinable? |
# |
Oct 3rd 2018, 14:50 |
ricksaccous |
i could put technically "valid" data |
# |
Oct 3rd 2018, 14:50 |
ricksaccous |
basically i could look at one field, and based on the relationships of that field (in the same table) the fk has a chance of being some value, but the relationships between the tables also means the fk could also have other values |
# |
Oct 3rd 2018, 14:48 |
btx |
how do you know it’s not accurate enough, like what is the inaccuracy? |
# |
Oct 3rd 2018, 14:47 |
ricksaccous |
i don't even know, lol |
# |
Oct 3rd 2018, 14:47 |
btx |
how would you handle the exceptions otherwise? manual linking? |
# |
Oct 3rd 2018, 14:46 |
ricksaccous |
and i can make it fairly accurate but not accurate enough |
# |
Oct 3rd 2018, 14:46 |
btx |
so , add column (without fk), link data, add fk |
# |
Oct 3rd 2018, 14:46 |
ricksaccous |
no i thought about it |
# |
Oct 3rd 2018, 14:46 |
btx |
could you add a script that links the field properly |
# |
Oct 3rd 2018, 14:46 |
ricksaccous |
yes |
# |
Oct 3rd 2018, 14:46 |
btx |
and that other table already exists with data in it? |
# |
Oct 3rd 2018, 14:46 |
ricksaccous |
the data "should" exist |
# |
Oct 3rd 2018, 14:45 |
ricksaccous |
to another table |
# |
Oct 3rd 2018, 14:45 |
ricksaccous |
no, i'm adding a column that i also want to attach a foreign key to |
# |
Oct 3rd 2018, 14:45 |
btx |
aren’t you adding a column for something that doesnt exist yet? |
# |
Oct 3rd 2018, 14:44 |
ricksaccous |
in this scenario maybe c) is the best option? |
# |
Oct 3rd 2018, 14:44 |
ricksaccous |
my choices are a ) junk data b) truncate or i guess c ) column can be nullable (even though it shouldn't) |
# |
Oct 3rd 2018, 14:43 |
ricksaccous |
before i figured i would just put junk data in it and they would realize it and fix it later or something, but it's prob better to just truncate it |
# |
Oct 3rd 2018, 14:43 |
lubos |
don't truncate if it is not what you (your next app stage) should do |
# |
Oct 3rd 2018, 14:42 |
ricksaccous |
are you sure |
# |
Oct 3rd 2018, 14:42 |
ricksaccous |
hey dude, you are truncating x table |
# |
Oct 3rd 2018, 14:42 |
ricksaccous |
and want to give a message somehow |