Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

I am able to form your "Sql-Based Database" connected to "Sequelize" to look like "Sequelize Models" in your "Sequelize Model Schemes"

License

NotificationsYou must be signed in to change notification settings

mohammadhb/sequelize-true-migration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

I am able to form your "Sql-Based Database" connected to "Sequelize" to look like "Sequelize Models" in your "Sequelize Model Schemes"

What is Migration ?

Migration is the process of moving from one to anotherForm ofDatabaseSinceMigration is version-based process and is reversible, our auto-migration system doesn't generate a single version file and do the changing and adding automatically. so you can't call it a migration it self but auto-migration.

Using

Caution : It's still in Beta phase so don't expect a very clean output although it won't delete or overwrite on your dataYet. But in the next updates we will add some features that includes doing this.Although it will come with granting your permission byOptions parameter.

Getting Started

Suppose you have a object of "Sequelize" :

constoptions={host   :host,port   :port,dialect:'mysql',define :{charset:'utf8',collate:'utf8_general_ci',}};constsequelize=newSequelize(tableName,userName,password,options);

Add "INFORMATION_SCHEMA" Database as a "Sequelize" Object Beside it ( in current runned "SQL-Based Database System" instance ) like below:

constoptions={host   :host,port   :port,dialect:'mysql',define :{charset:'utf8',collate:'utf8_general_ci',}};constsequelize=newSequelize(tableName,userName,password,options);constsequelizeInfo=newSequelize('INFORMATION_SCHEMA',userName,password,options);

And then add "sequelize-true-migration" package and Create new Object with "new" and call "synchronize" method for Syncing model with database:

constSequelizeTrueMigration=require('sequelize-true-migration');conststmObj=newSequelizeTrueMigration(name,sequelize,sequelizeInfo,database,{forceTruncate:false})stmObj.synchronize();

Caution : For getting affected restart your project. probably like this :

In Runner Systems :

  • Nodemon : On saving files
  • PM2 :
  pm2 restart %Name-Of-Your-Project%
  • Pure Node :
  Ctrl+c ( On running project )  node %Main-Project-File%.js

And Done. No need to Do Anything.

Development Progress

  • Main Development
  • Checing Tables and Create a NOT EXIST Table
  • Checing Columns and Create a NOT EXIST Column in Tables
  • Matching Columns and Model Definition and Fix Conflicts ( or Error On Something that needed Developer Attention)
  • Deleting Undefined Columns that corresponds in Models
  • Versioning Migrations and Rollback System
  • Writing Tests

About

I am able to form your "Sql-Based Database" connected to "Sequelize" to look like "Sequelize Models" in your "Sequelize Model Schemes"

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp