Migrate mySQL to Firebase [closed]

浪尽此生 提交于 2019-12-13 09:44:34

问题


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.


回答1:


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


来源:https://stackoverflow.com/questions/38425743/migrate-mysql-to-firebase

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!