ChickenKyiv / loopback-tutor-intern-10

GNU General Public License v3.0
0 stars 2 forks source link

run automigrate before calling a mongodb database #6

Closed atherdon closed 6 years ago

atherdon commented 6 years ago

when you'll switch from file with data into database - you'll need to run loopback.automigrate method. i have a samples, so buzz me and i'll move that information here.

5


Some information about migrations: first part it's a simple thing, you just need to call automigrate and specify tables that you need to drop. and you need to run that script from CLI

second part is complex and related to importing data from js array into db row.

you will need to create a file/files, with arrays(you can grab that data from db.json file) then you'll need to create a file where you'll actually import data from array into db. as before - you should check the latest version at search-api - and see how i did it here

louisevdb84 commented 6 years ago

Please send samples for the automigrate method. I have so long added 002-automigrate.js to my project under import-db-files as per your search-api example.

atherdon commented 6 years ago

you add all things that important. at migrate file you need to add all tables that you have. and when you'll run a migrate script from console - you'll drop all data at mongodatabase. so when you'll import a new data - you'll see a result. i assume you'll done it soon. nothing complex here.