Re: [Firebase] Firebase Realtime table deletion issue

25 views
Skip to first unread message

Kato Richardson

unread,
Jul 2, 2021, 12:27:41 PM7/2/21
to Firebase Google Group
Hi Batikan,

I can't guess how your data is being deleted of course. But it's fairly easy to prevent deletion.

A simple approach is a condition like the following in your .write rule (there are a number of more complex examples on Stack Overflow):  !data.exists() || newData.exists()

If you want to enforce a schema, you can use the .validate rule with something like this: hasChildren(['foo', 'bar'])

☼, Kato


On Tue, Jun 29, 2021 at 8:42 PM Batikan Toğnaş <batika...@gmail.com> wrote:
Hi, I am managing my entire app with firebase realtime. When a subscription is sold, I update the purchaser in the users table. Sometimes I see that my users' data in the firebase table is completely deleted. What could cause this? Why can users' user table be deleted? Is it possible to prevent deletion of data from the User table?
We have to give Read and Write permission.

Example code:

if (subsControl.subscriptions == true) {
subsControl.expiredTime = subsControl.expiredTime + increasedTime;
subsControl.membership = 1;
subsControl.memberStatus = 1;
MyApplication.getInstance().setmSubs(subsControl);
mDatabaseReference.child("/users/" + getUid()).setValue(subsControl);
showProgressDialog();
addTrack(date, productid, token, orderid, signatur, deviceId, getUID);
membershipkontrol();
}

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/08e7dcc9-987a-41b4-b652-4d480a778951n%40googlegroups.com.


--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

Reply all
Reply to author
Forward
0 new messages