So i have an application which currently stores data on an apache server and mysql. I want to migrate to firebase but i have the following problem:
My data is a Business table where each user has stored their data. This includes their email and all the data of their business (address, city, business name, etc.) I have exported the data in json and import it to firebase, but now i want the users to create a new profile (in firebase) and then "claim" their data.
This should be done in order to create a relationship between the user and the business.
Any ideas on how to do that?
EDITED:
So the problem was that i had the business and my user in one object or table like this:
{
"user_type": "Hotel",
"state": "Lakonia",
"postcode": "23100",
"city": "Mystras",
"country": "Greece",
"id": 1,
"num_of_rooms": "5",
"email": "info@email.com",
"address": "Something",
"time_of_register": "",
"name": "My hotel",
"latlng": ""
}
In order to migrate it to Firebase, I created a check, so when a user logs in, the system runs a query and if the users registration email is the same with one of the businesses, i move it to a new firebase data set, registered with the users unique key. Thus no i have two sets, one for my users and one for the business info.
解决方案
Should be fairly straight forward
Users
User_id_0
Name: frank
Business_ref: Business_id_0
User_Id_1
Name: buzz
Business_ref: Business_id_1
Businesses
Business_id_0
Business_name: Code'r' us
Owner: User_id_0
Business_id_1
Business_name: Burger Boooyaa
Owner: User_id_1