You have to take two steps,
Apply the auto-increment to the column for this you have two options:
a) Create a generator, for example
b) Use IDENTITY COLUMNS as fields for auto-increment
Remember to create the GENERATOR from the records you already have, for example, if you already have 15 records the generator you create it from 15.
Once you have modified the column properly, you have to increase the ID of each record, this is done with transactions, since I do not know what language you are using or your database will give you some examples:
var estimatesRef = firebase.child ('Estimates');
estimatesRef.once ('value', function (estimatesSnapshot) {
estimatesSnapshot.forEach (function (estimateSnapshot) {
estimateSnapshot.ref (). update ({
estimateSnapshot.val (). priority + 1
});
});
});
The previous code iterates within all estimated children and increases them.
public void incrementCounter() {
firebase.runTransaction(new Transaction.Handler() {
@Override
public Transaction.Result doTransaction(final MutableData currentData) {
if (currentData.getValue() == null) {
currentData.setValue(1);
} else {
currentData.setValue((Long) currentData.getValue() + 1);
}
return Transaction.success(currentData);
}
@Override
public void onComplete(FirebaseError firebaseError, boolean committed, DataSnapshot currentData) {
if (firebaseError != null) {
Log.d("Firebase counter increment failed.");
} else {
Log.d("Firebase counter increment succeeded.");
}
}
});
}
The previous code is in Java.
I leave you some references
FireBird Manual section PrimaryTables
Manual FireBird make transaction in different languages