How to customize the Database Schema of the accounts-password package?


#1

Recently i’ve had a time to play around with the accounts-password package. And I could use this package successfully. The schema that are built to store the data are not quite expected for my project. Thus I want to customize the database schema to make it my own way. How can I achieve this?


#2

You could fork the package, then make your changes to it. But then you’ll have to maintain your fork going forward, which would be a pain. I would keep it like it is, and instead add your own name space to the ‘services’ field, i.e. like accounts-facebook uses user.services.facebook.* for all FB data. This will preserve how the accounts package works and let you add whatever you want to it without having to worry about a future release or other package conflicting with your additions. Something like the following, where “my_custom_data” is where you put your own data model:

user = { 
      emails : [ ... ]
      services : {
          resume : [ ... ],
          facebook : { ... }
          my_custom_data : { ... }
       }
 }