cli icon indicating copy to clipboard operation
cli copied to clipboard

Migrations with sql raw scripts

Open LucasBadico opened this issue 5 years ago • 5 comments

We want to build migrations with raw sql

Migrations with anything more then sql files.

We want to use the migration interface of sequelize to run raw sql migrations. So everyone speak the same language across the company. DBAs, QAs, DEV in others stacks then js.

Everyone today already speak SQL.

Solution

A new subset of intelligence on sequelize for understanding sql files in migrations and seeds folders, like image bellow:

Captura de Tela 2019-09-04 às 16 04 50

Why should this be in Sequelize

Because its a great tool not just for running the applications but also for maintenance and cross development.

Issue Template Checklist

Is this issue dialect-specific?

  • [x] No. This issue is relevant to Sequelize as a whole.
  • [ ] Yes. This issue only applies to the following dialect(s): XXX, YYY, ZZZ

Would you be willing to resolve this issue by submitting a Pull Request?

  • [x] Yes, I have the time and I know how to start.
  • [ ] Yes, I have the time but I don't know how to start, I would need guidance.
  • [ ] No, I don't have the time, although I believe I could do it if I had the time...
  • [ ] No, I don't have the time and I wouldn't even know how to start.

LucasBadico avatar Sep 04 '19 19:09 LucasBadico

This totally makes sense.

[x] Yes, I have the time and I know how to start.

Nice!! Did you know that the migration library behind sequelize-cli (umzug) already supports this?

image

So it is probably easy to implement your request by simply making sequelize-cli allow passing a custom object to the underlying umzug object...

papb avatar Sep 05 '19 01:09 papb

I will migrate this issue to the sequelize-cli repository though

papb avatar Sep 05 '19 01:09 papb

This totally makes sense.

[x] Yes, I have the time and I know how to start.

Nice!! Did you know that the migration library behind sequelize-cli (umzug) already supports this?

image

So it is probably easy to implement your request by simply making sequelize-cli allow passing a custom object to the underlying umzug object...

Yes, I already using this feature. I have almost everthing here, the sql reader, the migration runner and the migration creator. I just have to integrate this with the migration runner of cli and the regex

LucasBadico avatar Sep 05 '19 14:09 LucasBadico

Awesome!! Please create the PR when you can! Thank you very much!

papb avatar Sep 05 '19 15:09 papb

Forked and branch starting. Maybe I will need some design opnion from you @papb.

LucasBadico avatar Sep 05 '19 17:09 LucasBadico