javascript - How to rename an IndexedDB database? - Stack Overflow

I created an IndexedDB databse named "A" by indexedDB.open method.Now I want to modify the da

I created an IndexedDB databse named "A" by indexedDB.open method.

Now I want to modify the database name to "B", how can I do it?

I dont't want to create a new database with new name and copy all data from old database to new database.

I created an IndexedDB databse named "A" by indexedDB.open method.

Now I want to modify the database name to "B", how can I do it?

I dont't want to create a new database with new name and copy all data from old database to new database.

Share asked Nov 22, 2013 at 13:42 cuixipingcuixiping 25.5k9 gold badges87 silver badges94 bronze badges 2
  • why you need to change a database name? generally database name should not tied to data. – Kyaw Tun Commented Nov 22, 2013 at 15:10
  • 1 Because I think the old name is ugly :) and maybe conflict with other apps in one site. – cuixiping Commented Nov 22, 2013 at 19:50
Add a ment  | 

3 Answers 3

Reset to default 5

From the main Documentation :

Every database has a name which identifies it within a specific origin.The name can be any string value, including the empty string, and stays constant for the lifetime of the database.

So, as it says, the name remains same for entire life.

It's a bit of a pain, but you could create a new database with the name you want, and copy everything from the old to the new. If you're using autoincrement IDs and you have cross-references by ID, you might need to generate maps of old-to-new id during transfers, and translate the references.

Renaming is supported in indexedDb v2.0. See https://hacks.mozilla/2016/10/whats-new-in-indexeddb-2-0/

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744819738a4595543.html

相关推荐

  • javascript - How to rename an IndexedDB database? - Stack Overflow

    I created an IndexedDB databse named "A" by indexedDB.open method.Now I want to modify the da

    2天前
    50

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信