{"id":22749569,"url":"https://github.com/lxsbw/db-base-sequelize","last_synced_at":"2026-05-01T03:38:49.059Z","repository":{"id":238709380,"uuid":"335650273","full_name":"Lxsbw/db-base-sequelize","owner":"Lxsbw","description":"sequelize transfer script","archived":false,"fork":false,"pushed_at":"2021-02-03T16:46:28.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-05T08:22:14.638Z","etag":null,"topics":["db","script","sequelize"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Lxsbw.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-03T14:26:29.000Z","updated_at":"2021-02-22T03:03:48.000Z","dependencies_parsed_at":"2024-05-07T17:26:49.803Z","dependency_job_id":"09266341-5490-4792-8d28-8404d7b21ddd","html_url":"https://github.com/Lxsbw/db-base-sequelize","commit_stats":null,"previous_names":["lxsbw/db-base-sequelize"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lxsbw%2Fdb-base-sequelize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lxsbw%2Fdb-base-sequelize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lxsbw%2Fdb-base-sequelize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lxsbw%2Fdb-base-sequelize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lxsbw","download_url":"https://codeload.github.com/Lxsbw/db-base-sequelize/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246281307,"owners_count":20752213,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["db","script","sequelize"],"created_at":"2024-12-11T04:09:24.958Z","updated_at":"2026-05-01T03:38:44.028Z","avatar_url":"https://github.com/Lxsbw.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# db-base-sequelize\n\ndb-base-sequelize\n\n### migration\n\n```初始化表结构\nnpx sequelize migration:generate --name=init-users\n```\n\n```执行 migrate 进行数据库变更\n# 升级数据库\nnpx sequelize db:migrate\n# 如果有问题需要回滚，可以通过 `db:migrate:undo` 回退一个变更\n# npx sequelize db:migrate:undo\n# 可以通过 `db:migrate:undo:all` 回退到初始状态\n# npx sequelize db:migrate:undo:all\n```\n\n### migration 新脚本\n\n```\n# 升级数据库\nnpm run migrate:up\n```\n\n### DataBase\n\n- table\\column\n  全小写，下划线分词\n- 主键  \n  id（pk 开头 or sequelize 默认）\n- 默认字段\n  - created_at\n  - updated_at\n  - deleted_at\n- not null\n  - 根据业务值进行默认值设置优先推荐的默认值顺序：''\u003e0\u003e-1\u003e特殊定义\n  - datetime、date、timestamp：按照业务需要为 null 的情况下，尽量作为辅助字段，不作为优先筛选字段，例如搭配 state 字段\n- function  \n  全小写下划线分词，[fun_]开头。根据业务复杂程度尽量不要启用自定义函数。\n- view  \n  全小写下划线分词，[view_]开头。\n- 关系  \n  [表名_id]\n- 常规业务采用三范式原则，交易、金钱、积分相关业务保证数据留痕，以及性能采用反范式。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flxsbw%2Fdb-base-sequelize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flxsbw%2Fdb-base-sequelize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flxsbw%2Fdb-base-sequelize/lists"}