How to handle DB Migrations in serverless environment? NodeJS+Lambda - node.js

Im coming from a .NET background(using EF). Im migrating my website to using NodeJS Lambda functions.
With EF, I would use code-first migrations, meaning EF generates the migration files for me. I've seen there are several NodeJS packages do do have migrations(TypeOrm,Seequalize,etc). What I don't understand about this is how would I handle migrations(for example, If I add a column or change the model) in a serverless, and microservices environment, since the is no central location that the migration files would be stored?

Related

Does any JS library for connecting to DB support a structure in raw SQL?

Most of my dev experience is based on Ruby on Rails. The framework supports having a DB schema in two formats:
RoR DSL
SQL for cases when DSL is not enough. For instance, having an initially deffered unique constraint in PostgreSQL.
If it's needed to set up a DB from scratch, for instance in CI, it's possible to run a CLI task that will use either of the files and apply it without any further need to run migration files.
About two weeks ago we started a project that based on ExpressJS + PrismaJS and now we need to have a custom SQL for the DB structure.
After reading the Prisma docs I found that it's possible to write a custom SQL inside migration files and this is exactly what we need for our production. However, we also would like to have the same DB schema in our CI. Is there any other way to have the same schema for CI as we have in production without running migration files one by one as I can do with RoR?

Angular with Oracle

I am trying to figure out if there is a way to build applications using Angular/ORDS/Oracle, i am new to this web stack. What i understood so far is we need one front end / back end / database to build entire application.
in general we use Angular/Nodejs/Sql Server to develop application. in this Angular is front ent/ Node js is used to build backend or web services. Sql server is the database.
Is there a good example or resource to learn how to build apps using Angular/ORDS/Oracle with one CRUD example.
With Oracle and ORDS, you'll just define some REST Services to feed data to your Angular app.
You'll hopefully be making VERY similar, GET, PUT, POST, & DELETE calls as you were doing before.
You can 'shape' the Service templates to have the mapping that you want. They are then back-ended by Oracle SQL and/or PL/SQL that runs in the database.
ORDS handles paging the results and transforming everything in and out of the database to {json}
I have lots of resources for you getting started with REST Services in Oracle here.

Feathersjs frontend and backend in a single project

I'm looking to build a small customer management portal for myself. I've recently started working with node and vuejs a lot (coming from an html/css/javascript background). I've really enjoyed CLI development though and am looking to build a customer management portal (nothing fancy) that has a MySQL backend. After studying frameworks and ideas I found feathersjs which I REALLY like. After a few hours I was able to have a REST api that returns data from my MySQL database and uses authentication. I can get MySQL data in a JSON datasource and even do inserts, updates, deletes. I generated the services and models using the feathersjs CLI generator.
My question is, do I really need to make two separate projects (one for backend and one for a public frontend) and run them each on a node server? Or could I do this in as single project? I'm still learning and reading up on feathersjs but I'm not seeing a way to make this possible. I do see a public folder in my feathersjs project that was generated but I don't know how to utilize it for node (I wanted my frontend written in Vue). I can see how static HTMLfiles would work in this public folder.

NodeJS ORM framework that updates migrations files from Model definitions

I am trying to set up a NodeJS backend with a MySQL database. I want to eventually containerize the database and containerize the backend server. To containerize the database, I need migration files.
I am looking for a framework that handles the generation of these migrations well. I have tried Sequelize, but you couldn't update your migrations based on your models.
I wanted to use AdonisJS but it was a full MVC framework, while the goal is to use it alongside Express.
Am I thinking the wrong way here?
Actually you can generate migrations from models in sequelize using sequelize-auto-migrations.

Best way to migrate table changes to production sailsjs tables

I just lost 11,000 records from my database just running the command for sailsjs without the --prod part in it, So I thought I should ask whats the best way to change the tables on production server when the Model.js has been changed ?
Thanks
Automated migration should never be done in production. This a common-sense practice that applies to any production system with important data. There are a few solutions available for migrating a sails.js database.
sails-db-migrate: db-migrate integration for sails.js
db-migrate integration for Sails.js. This is a fairly simple wrapper, which provides grunt tasks for running and creating migrations.
sails-migrations: The missing, migrations arm of the octopus
sails-migrations provides an easy way to manage database migrations with sails, based on the amazing https://github.com/tgriesser/knex lib. This means you can have fine-grained control over your schema/data transformations between versions.
Sequelize migrations
Sequelize 2.0.0 introduces a new CLI which is based on gulp and combines sequelize-cli and gulp-sequelize. The CLI ships support for migrations and project bootstrapping. With migrations you can transfer your existing database into another state and vice versa

Resources