-
-
Notifications
You must be signed in to change notification settings - Fork 526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate initial migration from model? #157
Comments
Yes. That would be a good idea and I'm planning to do that since a while already but never found the time for that :( On Tue, Jul 21, 2015 at 11:09 PM, James Sumners notifications@github.com
|
If I get a chance I'll see if I can work something up. But I'm not sure I'll have the opportunity. |
+1 :) |
+1 |
+1. Well, it is just javascript, so im going to make a file that exports the javascript object, that the model in models/ and migrations/ can import. Not going to set my self up for the inevitable 'change one place, but forgot the other' |
+1 |
1 similar comment
+1 |
Is there any progress? or alternative? |
no progress afaik |
+1 Will be the very popular feature. I hope this feature will be implemented |
+1 |
9 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
By the way, now I use https://github.com/Vincit/objection.js/ |
+1 Though currently I'm doing it this way: https://gist.github.com/notgiorgi/7276aae5baebb5725799ce0f5b8468f3 |
I would like to start working on this feature. Can anyone give me pointers on where I should begin? |
+1 |
5 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
Has any work been done towards achieving this? Can anyone outline the steps that should be taken to do this? I come from Django which does all of this for you, so it was very surprisingly to learn that such basic ORM functionality does not exist out of the box for this package (same with: #257) Our company is starting a new long term project using Sequelize. Since this is obviously very sought after functionality based on all the +1s; and since the maintainers are absent in addressing it, if someone can point me to any initial work that has already been done on the subject we can start to add some cycles to addressing it. From what I see, these are the best candidates for this type of functionality so far:
Instead of all the people saying +1 why don't we just do something about it? @jsumners @sdepold have you made any progress, or do you have an outline of the steps you would take to add this feature? If a PR was made to add this, would it be addressed or is this something best left to external packages like |
@cjancsar sorry. I never progressed past reasearching this module. |
I had started reverse engineering the django orm a month ago. The important
thing is there is no diagram or such algorithm that atleast outlines the
necessary steps.
My analysis:-
1. Django looks for a migrations folder.
2. If present it searches for the latest migration.
3. It compares the current change with migration file along with the
database fields i.e. it identifies changes as operations.
4. Creates a string out of these operations and then writes it to a file.
5. It also writes dependencies to the newly created file in order to
rollback changes. These are done by a singly linked list and if any
dependency loop occurs an error is thrown.
Someone please let me know if any tutorials exist for creating this. We can
split the tasks amongst ourselves. This can be completed in 2 months time
with adequate research.
Karra Raghu Ram
…On Sun, 7 Jul, 2019, 9:25 PM James Sumners, ***@***.***> wrote:
@cjancsar <https://github.com/cjancsar> sorry. I never progressed past
reasearching this module.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#157?email_source=notifications&email_token=AD34HHEGJH2C724VU5SLF6LP6IGWPA5CNFSM4BLUMXD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZLOGQA#issuecomment-509010752>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AD34HHBYZBIU7L47VZG5MN3P6IGWPANCNFSM4BLUMXDQ>
.
|
+1 |
Started using sequelizer today, seems a great ORM but just jumped into this, which I think is a feature that it should have from the beggining :( |
Same! |
I am literally going to abandon sequelize, never use it again, and recommend everyone else stay far away from it if this feature doesn't come very soon. |
Guys, I managed to get myself another tool working next to sequelize, and now I have the full set. I use Sequelize only as a mapper for interacting with the database, and for migrations Im using Postgrator. I really recommend you guys taking a look at it. It's really similar to Flyway (for Spring) and It applies database version control in an easy way. I find It a great combo, and I dont need the migrations features of Sequelize anymore, I even find that Postgrator is better with that than Sequelize would be. So just create the DB with the Sequelize models, and when you are ready just dump it and use that .sql file as the first version of your database for Postgrator :) |
No progress yet ? |
|
+1 |
That's a very bad feeling...... |
This feature should really be implemented in the official CLI. There was a nice side project doing it but it feels a bit abandon : https://github.com/flexxnn/sequelize-auto-migrations Might still be a good pointer to start the implementation. |
@janmeier this feature request is opened since 2015. Could you let us know if there is any progress on it ? To me, |
+1, hello from 2020 |
Any hope in 2020? |
No hope :)) |
There is a hope now https://github.com/flexxnn/sequelize-auto-migrations |
@webdevbyjoss as I commented previously, sadly this project feels a bit abandoned ... |
Hi everyone, this project is not abandoned, however I am super busy at the main repo for now; hopefully in the near future I will be able to make the super overhaul that I am planning for the Sequelize CLI. Thanks for the patience so far 😬 |
Hi @papb, I was speaking about https://github.com/flexxnn/sequelize-auto-migrations. |
I wonder if anyone could recommend an alternative library which has this feature implemented. |
define "near" |
i see this is a miss from sequelize, it can be every helpful generating initial migration from defined models, here we have to copy it again in two places with sync off feature !! |
…ror like no such file
…ror like no such file
It was solved with sequelize-auto. Afte make the migration, run sequelize-auto to sync the model file |
I'm just getting started with Sequelize and the CLI. I want my project's initial database to be bootstrapable with
sequelize db:migrate
(i.e. create the database from nothing with an initial set of migrations). In that regard, it seems to me that I am duplicating a lot of code.I have a simple two table test project at https://github.com/jsumners/sequelize-migration-test that shows what I'm describing.
Would it not be possible (make more sense) for
sequelize migration:generate
to read the already defined model and generate the migration from that definition?The text was updated successfully, but these errors were encountered: