What happened to SqlStorage?


#1

Back in Ionic 2’s beta days, I created an app with offline data support using Ionic’s built-in SqlStorage API. Ionic’s team even did a nice tutorial around it:
http://blog.ionic.io/building-an-ionic-app-with-offline-support-part-1/

In Ionic 2 RC0, Storage and SqlStorage classes have suddenly disappeared from ionic-angular module. Furthermore, the Storage link in Ionic 2’s docs leads to a 404:

I wonder what happened to SqlStorage. Why was it dropped? Is there a baked-in alternative or do we now have to rely on Ionic Native’s SQLite API? Personally, I found SqlStorage’s API much simpler than SQLite’s.


#2

That’s mentioned in the changelog for 2.0.0-rc.0, third bullet point.


#3

Many thanks! I completely missed it before.


#4

Hmm. I was too quick to mark @mirkonasato’s post as the solution. The changelog for v2 RC0 mentions the Storage class/module. This thread is specifically about SqlStorage. As it turned out, SqlStorage is missing from storage module.


#5

#6

@maxx0r: I saw that. As I said, SqlStorage is not present in @ionic/storage module. Or am I missing something?


#7

So, basically all of the previous *Storages (i.e. LocalStorage and SqlStorage) have been combined into a singule Storage class that acts as A simple key-value Storage module for Ionic apps (copied from the ionic-angular GitHub page). Basically this will automatically attempt to use whatever storage solution is available, including SQLite.

To clarify even further, if you just want to store Key/Value Pairs then this solution might/should work well for you. If you need full SQL support than you will indeed have to look elsewhere, such as the Ionic Native SQLite plugin you mentioned, as there’s no builtin class for this anymore.


#8

Thanks for the explanation @SigmundFroyd. It makes a lot of sense now.