├── .gitignore ├── .idea ├── modules.xml ├── sequelize-pg-generator.iml └── vcs.xml ├── History.md ├── LICENSE ├── Makefile ├── README-JSDOC-TR.md ├── README-JSDOC.md ├── README-TR.md ├── README.md ├── config └── default.js ├── doc ├── GeneratorUtil.html ├── classes.list.html ├── img │ ├── glyphicons-halflings-white.png │ └── glyphicons-halflings.png ├── index.html ├── lib_index.js.html ├── module-lib_index.html ├── module-path_to_model.html ├── modules.list.html ├── scripts │ ├── URI.js │ ├── bootstrap-dropdown.js │ ├── bootstrap-tab.js │ ├── docstrap.lib.js │ ├── prettify │ │ ├── Apache-License-2.0.txt │ │ ├── jquery.min.js │ │ ├── lang-css.js │ │ └── prettify.js │ ├── sunlight.js │ └── toc.js ├── styles │ ├── darkstrap.css │ ├── prettify-tomorrow.css │ ├── site.amelia.css │ ├── site.cerulean.css │ ├── site.cosmo.css │ ├── site.cyborg.css │ ├── site.darkstrap.css │ ├── site.flatly.css │ ├── site.journal.css │ ├── site.readable.css │ ├── site.simplex.css │ ├── site.slate.css │ ├── site.spacelab.css │ ├── site.spruce.css │ ├── site.superhero.css │ ├── site.united.css │ ├── sunlight.dark.css │ └── sunlight.default.css ├── template_default_index.js.html ├── template_index.js.html ├── template_sequelize4_index.js.html └── template_utils.js.html ├── jsdoc-conf.json ├── lib ├── _polyfill-quote.js ├── bin │ └── spgen.js ├── index.js └── sequelize-types.js ├── package-lock.json ├── package.json ├── template ├── default │ ├── column.html │ ├── index.html │ ├── index.js │ ├── relation.html │ └── table.html ├── sequelize4 │ ├── column.html │ ├── index.html │ ├── index.js │ ├── relation.html │ └── table.html └── utils.js └── test ├── generate-different-config.js ├── generate-different-sequelize4-template.js ├── generate.js ├── usage.js └── util ├── config ├── reverse-config.json └── template-sequelize4.json ├── create-test-db-1.sql ├── create-test-db-2.sql └── db.js /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/node,webstorm,visualstudiocode,macos,windows,linux 3 | 4 | ### Linux ### 5 | *~ 6 | 7 | # temporary files which can be created if a process still has a handle open of a deleted file 8 | .fuse_hidden* 9 | 10 | # KDE directory preferences 11 | .directory 12 | 13 | # Linux trash folder which might appear on any partition or disk 14 | .Trash-* 15 | 16 | # .nfs files are created when an open file is removed but is still being accessed 17 | .nfs* 18 | 19 | ### macOS ### 20 | *.DS_Store 21 | .AppleDouble 22 | .LSOverride 23 | 24 | # Icon must end with two \r 25 | Icon 26 | 27 | 28 | # Thumbnails 29 | ._* 30 | 31 | # Files that might appear in the root of a volume 32 | .DocumentRevisions-V100 33 | .fseventsd 34 | .Spotlight-V100 35 | .TemporaryItems 36 | .Trashes 37 | .VolumeIcon.icns 38 | .com.apple.timemachine.donotpresent 39 | 40 | # Directories potentially created on remote AFP share 41 | .AppleDB 42 | .AppleDesktop 43 | Network Trash Folder 44 | Temporary Items 45 | .apdisk 46 | 47 | ### Node ### 48 | # Logs 49 | logs 50 | *.log 51 | npm-debug.log* 52 | yarn-debug.log* 53 | yarn-error.log* 54 | 55 | # Runtime data 56 | pids 57 | *.pid 58 | *.seed 59 | *.pid.lock 60 | 61 | # Directory for instrumented libs generated by jscoverage/JSCover 62 | lib-cov 63 | 64 | # Coverage directory used by tools like istanbul 65 | coverage 66 | 67 | # nyc test coverage 68 | .nyc_output 69 | 70 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 71 | .grunt 72 | 73 | # Bower dependency directory (https://bower.io/) 74 | bower_components 75 | 76 | # node-waf configuration 77 | .lock-wscript 78 | 79 | # Compiled binary addons (http://nodejs.org/api/addons.html) 80 | build/Release 81 | 82 | # Dependency directories 83 | node_modules/ 84 | jspm_packages/ 85 | 86 | # Typescript v1 declaration files 87 | typings/ 88 | 89 | # Optional npm cache directory 90 | .npm 91 | 92 | # Optional eslint cache 93 | .eslintcache 94 | 95 | # Optional REPL history 96 | .node_repl_history 97 | 98 | # Output of 'npm pack' 99 | *.tgz 100 | 101 | # Yarn Integrity file 102 | .yarn-integrity 103 | 104 | # dotenv environment variables file 105 | .env 106 | 107 | 108 | ### VisualStudioCode ### 109 | .vscode/* 110 | !.vscode/settings.json 111 | !.vscode/tasks.json 112 | !.vscode/launch.json 113 | !.vscode/extensions.json 114 | 115 | ### WebStorm ### 116 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm 117 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 118 | 119 | # User-specific stuff: 120 | .idea/**/workspace.xml 121 | .idea/**/tasks.xml 122 | .idea/dictionaries 123 | 124 | # Sensitive or high-churn files: 125 | .idea/**/dataSources/ 126 | .idea/**/dataSources.ids 127 | .idea/**/dataSources.xml 128 | .idea/**/dataSources.local.xml 129 | .idea/**/sqlDataSources.xml 130 | .idea/**/dynamic.xml 131 | .idea/**/uiDesigner.xml 132 | 133 | # Gradle: 134 | .idea/**/gradle.xml 135 | .idea/**/libraries 136 | 137 | # Mongo Explorer plugin: 138 | .idea/**/mongoSettings.xml 139 | 140 | ## File-based project format: 141 | *.iws 142 | 143 | ## Plugin-specific files: 144 | 145 | # IntelliJ 146 | /out/ 147 | 148 | # mpeltonen/sbt-idea plugin 149 | .idea_modules/ 150 | 151 | # JIRA plugin 152 | atlassian-ide-plugin.xml 153 | 154 | # Cursive Clojure plugin 155 | .idea/replstate.xml 156 | 157 | # Crashlytics plugin (for Android Studio and IntelliJ) 158 | com_crashlytics_export_strings.xml 159 | crashlytics.properties 160 | crashlytics-build.properties 161 | fabric.properties 162 | 163 | ### WebStorm Patch ### 164 | # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 165 | 166 | # *.iml 167 | # modules.xml 168 | # .idea/misc.xml 169 | # *.ipr 170 | 171 | # Sonarlint plugin 172 | .idea/sonarlint 173 | 174 | ### Windows ### 175 | # Windows thumbnail cache files 176 | Thumbs.db 177 | ehthumbs.db 178 | ehthumbs_vista.db 179 | 180 | # Folder config file 181 | Desktop.ini 182 | 183 | # Recycle Bin used on file shares 184 | $RECYCLE.BIN/ 185 | 186 | # Windows Installer files 187 | *.cab 188 | *.msi 189 | *.msm 190 | *.msp 191 | 192 | # Windows shortcuts 193 | *.lnk 194 | 195 | # End of https://www.gitignore.io/api/node,webstorm,visualstudiocode,macos,windows,linux 196 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/sequelize-pg-generator.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /History.md: -------------------------------------------------------------------------------- 1 | 2 | --------------------------------------- 3 | 4 | 5 | History & Release Notes 6 | ======================= 7 | 8 | Note 9 | ---- 10 | Version history for minimal documentation updates are not listed here to prevent cluttering. 11 | 12 | ###### 0.9.0 13 | * Added: sequelize-types are added. (pg-structure deprecated it.) 14 | 15 | ###### 0.8.0 / 2015-10-14 16 | * Added: `alias.json` file is generated in target directory to let developer easily override relationship names. 17 | 18 | ###### 0.7.0 / 2015-10-14 19 | * Changed: Location of utils.js is changed to inside of model directory. 20 | 21 | ###### 0.6.0 / 2015-09-10 22 | * -t --templateName parameter added to spgen. This name is used to choose one of the builtin template directories. 23 | * sequalize4 template added for protect backward compatibility. 24 | * sequalize4 template supports object references property. (references and referencesKey will be depreciated in Sequelize 4) 25 | 26 | ###### 0.5.4 / 2015-06-16 27 | * pg-structure updated to latest version. 28 | 29 | ###### 0.5.3 / 2015-06-16 30 | * Added: JSONB support and Boolean default value. Contributed by viniciuspinto (https://github.com/viniciuspinto) 31 | 32 | ###### 0.4.2 / 2015-04-27 33 | * Added documentation and examples. 34 | 35 | ###### 0.3.1 / 2015-01-10 36 | * Tested for Sequelize 2.0 RC7 37 | 38 | ###### 0.3.0 / 2014-12-30 39 | * Removed: pg-native dependency removed. Some users experienced problems during install. 40 | * Added: generate.addRelationNameToManyToMany configuration to prefix relation aliases prevent further name clashes which cannot be prevented by generate.addTableNameToManyToMany. Default: true. 41 | * Added: generate.stripFirstTableNameFromManyToMany configuration added. Default: true 42 | * Changed: generate.addTableNameToManyToMany configuration default is false now. 43 | * Changed: Default naming rule for many to many relations. 44 | * Added: Logging uses Winston module now. 45 | * Added: Doc update for Windows OS users. 46 | * Fixed: Database tables without any column throws error when warning configuration is true. 47 | 48 | ###### 0.2.0 / 2014-12-27 49 | * Added: Automatic alias and naming validations to prevent name clash. 50 | * Added: generate.addTableNameToManyToMany configuration to prefix relation aliases prevent name clash. Default: true. 51 | * Added: --throwError option added to CLI. This option decides wheter to throw error or simply log. 52 | * Added: Prevent hasMany through and belongsToMany true at the same time. 53 | * Fixed: generate.prefixForBelongsTo aliases are not properly camel cased. 54 | * Fixed: --resetConfig option does not work from CLI 55 | * Doc update 56 | 57 | ###### 0.1.17 / 2014-12-26 58 | * Fixed: CLI command does not work. 59 | * Added: Required parameters warning. 60 | 61 | ###### 0.1.15 / 2014-12-26 62 | * Added: Turkish documentation added. 63 | * Fixed: Typos and mistakes in documents. 64 | 65 | ###### 0.1.12 / 2014-12-23 66 | * Added: Tests added. 67 | * Added: --nolog option added to spgen command. 68 | * Added: --resetConfig option. Also details and caveat added to the document. 69 | * Fix: lib/index.js exported function expects different parameters than written in documentation. 70 | * Fix: Command line arguments fixed. 71 | * Fix: Data type variable name configuration is ignored. 72 | * Document update. 73 | 74 | ###### 0.1.0 / 2014-12-23 75 | * Initial version. 76 | 77 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Özüm Eldoğan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | REPORTER = list 2 | 3 | test: 4 | clear 5 | echo Starting test ********************************************************* 6 | ./node_modules/mocha/bin/mocha 7 | echo Ending test 8 | 9 | doc: 10 | clear 11 | echo Starting JSDOC ********************************************************* 12 | jsdoc -c jsdoc-conf.json README-JSDOC.md 13 | echo Creating README.md ***************************************************** 14 | rm -f README.md 15 | jsdoc2md --src lib/index.js template/utils.js template/index.js >>JSDOC.md 16 | cat README-JSDOC.md JSDOC.md History.md LICENSE > README.md 17 | cat README-JSDOC-TR.md JSDOC.md History.md LICENSE > README-TR.md 18 | rm -r -f JSDOC.md 19 | 20 | .PHONY: test doc 21 | -------------------------------------------------------------------------------- /config/default.js: -------------------------------------------------------------------------------- 1 | /*jslint node: true, nomen: true*/ 2 | "use strict"; 3 | 4 | var path = require('path'); 5 | 6 | module.exports = { 7 | "sequelize-pg-generator": { 8 | "database": { 9 | "host": "127.0.0.1", 10 | "port": 5432, 11 | "user": "user", 12 | "password": "password", 13 | "database": "", 14 | "schema": ["public"] 15 | }, 16 | "template": { 17 | "engine": "swig", 18 | "extension": "html", 19 | "folder": path.join(__dirname, '..', 'template', 'default') 20 | }, 21 | "output": { 22 | "log": true, 23 | "folder": "./model", 24 | "beautify": true, 25 | "indent": 4, 26 | "preserveNewLines": false, 27 | "warning": true 28 | }, 29 | "generate": { 30 | "stripFirstTableFromHasMany": true, 31 | "addTableNameToManyToMany": false, 32 | "addRelationNameToManyToMany": true, 33 | "stripFirstTableNameFromManyToMany": true, 34 | "hasManyThrough": false, 35 | "belongsToMany": true, 36 | "prefixForBelongsTo": "related", 37 | "useSchemaName": true, 38 | "modelCamelCase": true, 39 | "relationAccessorCamelCase": true, 40 | "columnAccessorCamelCase": true, 41 | "columnDefault": false, 42 | "columnDescription": true, 43 | "columnAutoIncrement": true, 44 | "tableDescription": true, 45 | "dataTypeVariable": "Seq", 46 | "skipTable": [] 47 | }, 48 | "tableOptions": { 49 | "timestamps": false 50 | } 51 | } 52 | }; 53 | -------------------------------------------------------------------------------- /doc/GeneratorUtil.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | sequelize-pg-generator Class: GeneratorUtil 7 | 8 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 59 | 60 |
61 | 62 | 63 |
64 | 65 |
66 | 67 | 68 | 69 |

Class: GeneratorUtil

70 |
71 | 72 |
73 |

74 | GeneratorUtil 75 |

76 | 77 |
78 | 79 |
80 |
81 | 82 | 83 | 84 | 85 |
86 |

new GeneratorUtil(model)

87 | 88 | 89 |
90 |
91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 |
Parameters:
100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 |
NameTypeDescription
model 128 | 129 |
141 | 142 | 143 | 144 | 145 |
146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 |
Source:
168 |
169 | 175 |
176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 |
184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 |
198 | 199 | 200 |
201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 |

Methods

216 | 217 |
218 | 219 |
220 |

getAttribute(name) → {Object}

221 | 222 | 223 |
224 |
225 | 226 | 227 |
228 |

Searches and returns attribute with the given alias. Alias is defined in sequelize options with parameter 'as'

229 |
230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 |
Parameters:
238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 |
NameTypeDescription
name 266 | 267 | 268 | string 269 | 270 | 271 | 272 |

Name of the attribute.

284 | 285 | 286 | 287 | 288 |
289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 |
Source:
311 |
312 | 318 |
319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 |
327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 |
Returns:
339 | 340 | 341 | 342 | 343 |
344 |
345 | Type 346 |
347 |
348 | 349 | Object 350 | 351 | 352 |
353 |
354 | 355 | 356 | 357 | 358 | 359 |
360 | 361 | 362 | 363 |
364 |

getRelation(as) → {Object}

365 | 366 | 367 |
368 |
369 | 370 | 371 |
372 |

Searches and returns relation with the given alias. Alias is defined in sequelize options with parameter 'as'

373 |
374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 |
Parameters:
382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 |
NameTypeDescription
as 410 | 411 | 412 | string 413 | 414 | 415 | 416 |

Alias of the relation.

428 | 429 | 430 | 431 | 432 |
433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 |
Source:
455 |
456 | 462 |
463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 |
471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 |
Returns:
483 | 484 | 485 | 486 | 487 |
488 |
489 | Type 490 |
491 |
492 | 493 | Object 494 | 495 | 496 |
497 |
498 | 499 | 500 | 501 | 502 | 503 |
504 | 505 | 506 | 507 |
508 |

renameAttribute(oldName, newName)

509 | 510 | 511 |
512 |
513 | 514 | 515 |
516 |

Searches and returns attribute with the given alias. Alias is defined in sequelize options with parameter 'as'

517 |
518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 |
Parameters:
526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 |
NameTypeDescription
oldName 554 | 555 | 556 | string 557 | 558 | 559 | 560 |

Name of the attribute which it's name to be changed.

newName 577 | 578 | 579 | string 580 | 581 | 582 | 583 |

New name of the attribute.

595 | 596 | 597 | 598 | 599 |
600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 |
Source:
622 |
623 | 629 |
630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 |
638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 |
Throws:
648 | 649 | 650 | 651 |
652 | 653 |

Will throw error if there is already an attribute with new name exists or attribute with oldName does not exists.

654 | 655 |
656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 |
664 | 665 |
666 | 667 | 668 | 669 | 670 | 671 |
672 | 673 |
674 | 675 | 676 | 677 | 678 |
679 | 680 |
681 |
682 | 683 | 684 | 685 | sequelize-pg-generator Copyright © 2014 Özüm Eldoğan. 686 | 687 |
688 | 689 | 690 | Documentation generated by JSDoc 3.4.0-dev 691 | on Fri Nov 27th 2015 using the DocStrap template. 693 | 694 |
695 |
696 | 697 | 698 |
699 |
700 |
701 | 702 |
703 |
704 | 705 |
706 | 707 | 708 | 709 | 710 | 711 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | -------------------------------------------------------------------------------- /doc/classes.list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | sequelize-pg-generator Classes 7 | 8 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 59 | 60 |
61 | 62 | 63 |
64 | 65 |
66 | 67 | 68 | 69 |

Classes

70 |
71 | 72 |
73 |

74 | 75 |

76 | 77 |
78 | 79 |
80 |
81 | 82 | 83 | 84 | 85 | 86 | 87 |
88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 |
116 | 117 | 118 | 119 | 120 |
121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 |

Classes

130 | 131 |
132 |
GeneratorUtil
133 |
134 |
135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 |
147 | 148 |
149 | 150 | 151 | 152 | 153 |
154 | 155 |
156 |
157 | 158 | 159 | 160 | sequelize-pg-generator Copyright © 2014 Özüm Eldoğan. 161 | 162 |
163 | 164 | 165 | Documentation generated by JSDoc 3.4.0-dev 166 | on Fri Nov 27th 2015 using the DocStrap template. 168 | 169 |
170 |
171 | 172 | 173 |
174 |
175 |
176 | 177 |
178 |
179 | 180 |
181 | 182 | 183 | 184 | 185 | 186 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | -------------------------------------------------------------------------------- /doc/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozum/sequelize-pg-generator/c38491b4d560981713a96a1923ad48d70e4aaff8/doc/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /doc/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozum/sequelize-pg-generator/c38491b4d560981713a96a1923ad48d70e4aaff8/doc/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /doc/module-lib_index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | sequelize-pg-generator Module: lib/index 7 | 8 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 59 | 60 |
61 | 62 | 63 |
64 | 65 |
66 | 67 | 68 | 69 |

Module: lib/index

70 |
71 | 72 |
73 |

74 | lib/index 75 |

76 | 77 |
78 | 79 |
80 |
81 | 82 | 83 |
84 |

require("lib/index")(callback, options)

85 | 86 | 87 |
88 |
89 | 90 | 91 |
92 |

Generates model files for Sequelize ORM.

93 |
94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 |
Parameters:
102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 160 | 161 | 162 | 163 | 164 | 165 | 422 | 423 | 424 | 425 | 426 |
NameTypeDescription
callback 130 | 131 | 132 | function 133 | 134 | 135 | 136 |

Function to execute after completion of auto generation. callback(err)

options 153 | 154 | 155 | object 156 | 157 | 158 | 159 |

Options to override configuration parameters from config file

166 |
Properties
167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 |
NameTypeDescription
host 195 | 196 | 197 | string 198 | 199 | 200 | 201 |

IP address or host name of the database server

port 218 | 219 | 220 | number 221 | 222 | 223 | 224 |

Port of database server to connect

database 241 | 242 | 243 | string 244 | 245 | 246 | 247 |

Database name

user 264 | 265 | 266 | string 267 | 268 | 269 | 270 |

Username to connect to database

password 287 | 288 | 289 | string 290 | 291 | 292 | 293 |

Password to connect to database

schema 310 | 311 | 312 | Array 313 | 314 | 315 | 316 |

List of comma separated names of the database schemas to traverse. Example public,extra_schema.

output 333 | 334 | 335 | string 336 | 337 | 338 | 339 |

Output folder

config 356 | 357 | 358 | string 359 | 360 | 361 | 362 |

Path of the configuration file

nolog 379 | 380 | 381 | boolean 382 | 383 | 384 | 385 |

Don't output log of generated files.

resetConfig 402 | 403 | 404 | boolean 405 | 406 | 407 | 408 |

Reset configuration via side-step solution to prevent singleton behaviour. (Not recomended for production)

420 | 421 |
427 | 428 | 429 | 430 | 431 |
432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 |
Source:
454 |
455 | 461 |
462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 |
470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 |
484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 |
492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 |
Author:
504 |
505 |
    506 |
  • Özüm Eldoğan
  • 507 |
508 |
509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 |
Source:
521 |
522 | 528 |
529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 |
537 | 538 | 539 | 540 | 541 |
542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 |
561 | 562 |
563 | 564 | 565 | 566 | 567 |
568 | 569 |
570 |
571 | 572 | 573 | 574 | sequelize-pg-generator Copyright © 2014 Özüm Eldoğan. 575 | 576 |
577 | 578 | 579 | Documentation generated by JSDoc 3.4.0-dev 580 | on Fri Nov 27th 2015 using the DocStrap template. 582 | 583 |
584 |
585 | 586 | 587 |
588 |
589 |
590 | 591 |
592 |
593 | 594 |
595 | 596 | 597 | 598 | 599 | 600 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | -------------------------------------------------------------------------------- /doc/modules.list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | sequelize-pg-generator Modules 7 | 8 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 59 | 60 |
61 | 62 | 63 |
64 | 65 |
66 | 67 | 68 | 69 |

Modules

70 |
71 | 72 |
73 |

74 | 75 |

76 | 77 |
78 | 79 |
80 |
81 | 82 | 83 | 84 | 85 | 86 | 87 |
88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 |
116 | 117 | 118 | 119 | 120 |
121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 |

Classes

130 | 131 |
132 |
GeneratorUtil
133 |
134 |
135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 |
147 | 148 |
149 | 150 | 151 | 152 | 153 |
154 | 155 |
156 |
157 | 158 | 159 | 160 | sequelize-pg-generator Copyright © 2014 Özüm Eldoğan. 161 | 162 |
163 | 164 | 165 | Documentation generated by JSDoc 3.4.0-dev 166 | on Fri Nov 27th 2015 using the DocStrap template. 168 | 169 |
170 |
171 | 172 | 173 |
174 |
175 |
176 | 177 |
178 |
179 | 180 |
181 | 182 | 183 | 184 | 185 | 186 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | -------------------------------------------------------------------------------- /doc/scripts/bootstrap-dropdown.js: -------------------------------------------------------------------------------- 1 | /* ============================================================ 2 | * bootstrap-dropdown.js v2.3.2 3 | * http://getbootstrap.com/2.3.2/javascript.html#dropdowns 4 | * ============================================================ 5 | * Copyright 2013 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ============================================================ */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* DROPDOWN CLASS DEFINITION 27 | * ========================= */ 28 | 29 | var toggle = '[data-toggle=dropdown]' 30 | , Dropdown = function (element) { 31 | var $el = $(element).on('click.dropdown.data-api', this.toggle) 32 | $('html').on('click.dropdown.data-api', function () { 33 | $el.parent().removeClass('open') 34 | }) 35 | } 36 | 37 | Dropdown.prototype = { 38 | 39 | constructor: Dropdown 40 | 41 | , toggle: function (e) { 42 | var $this = $(this) 43 | , $parent 44 | , isActive 45 | 46 | if ($this.is('.disabled, :disabled')) return 47 | 48 | $parent = getParent($this) 49 | 50 | isActive = $parent.hasClass('open') 51 | 52 | clearMenus() 53 | 54 | if (!isActive) { 55 | if ('ontouchstart' in document.documentElement) { 56 | // if mobile we we use a backdrop because click events don't delegate 57 | $('