将MySQL迁移到Firebase [英] Migrate mySQL to Firebase

查看:129
本文介绍了将MySQL迁移到Firebase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个当前在apache服务器和mysql上存储数据的应用程序。我想迁移到firebase,但遇到以下问题:

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:

我的数据是每个用户都存储了数据的Business表。这包括他们的电子邮件以及其业务的所有数据(地址,城市,公司名称等)。我已将数据导出到json中,并将其导入到firebase中,但是现在我希望用户创建一个新的配置文件(在firebase中)然后声明他们的数据。

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?

已编辑:

因此,问题是我将业务和用户放在一个这样的对象或表中:

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": ""
}

为了将其迁移到 Firebase ,我创建了一个检查,因此当用户登录时,系统会运行查询,并且如果用户注册电子邮件与某企业之一相同,我会将其移至新的firebase数据集,并在用户的唯一密钥。因此,我没有两套,一套用于用户,一套用于商业信息。

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.

推荐答案

应该很简单

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

这篇关于将MySQL迁移到Firebase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆