{"id":15003442,"url":"https://github.com/ariga/atlas-provider-sequelize","last_synced_at":"2025-10-30T11:30:22.920Z","repository":{"id":195736801,"uuid":"688353462","full_name":"ariga/atlas-provider-sequelize","owner":"ariga","description":"Sequelize provider for https://atlasgo.io","archived":false,"fork":false,"pushed_at":"2024-12-24T13:59:55.000Z","size":120,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-02-07T14:43:04.028Z","etag":null,"topics":["mysql","postgresql","sqlite","sqlserver"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ariga.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-09-07T07:14:05.000Z","updated_at":"2025-02-01T19:00:36.000Z","dependencies_parsed_at":"2024-09-19T09:48:11.516Z","dependency_job_id":"c638eb49-006f-4af1-aa13-77fd6a69face","html_url":"https://github.com/ariga/atlas-provider-sequelize","commit_stats":{"total_commits":35,"total_committers":4,"mean_commits":8.75,"dds":0.2857142857142857,"last_synced_commit":"2cc78e266859b8572ba98d5cecc983409b5b1a83"},"previous_names":["ariga/atlas-provider-sequelize"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariga%2Fatlas-provider-sequelize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariga%2Fatlas-provider-sequelize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariga%2Fatlas-provider-sequelize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariga%2Fatlas-provider-sequelize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ariga","download_url":"https://codeload.github.com/ariga/atlas-provider-sequelize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238955607,"owners_count":19558452,"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":["mysql","postgresql","sqlite","sqlserver"],"created_at":"2024-09-24T18:58:30.543Z","updated_at":"2025-10-30T11:30:22.913Z","avatar_url":"https://github.com/ariga.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# atlas-provider-sequelize\n\n![CI](https://github.com/ariga/atlas-provider-sequelize/actions/workflows/ci.yaml/badge.svg)\n\nUse [Atlas](https://atlasgo.io/) with [Sequelize](https://sequelize.org/) to manage your database schema as code. By connecting your Sequelize models to Atlas,\nyou can define and edit your schema directly in TypeScript or JavaScript. Atlas will then automatically plan and apply database schema migrations for you, \neliminating the need to write migrations manually.\n\nAtlas brings automated CI/CD workflows to your database, along with built-in support for [testing](https://atlasgo.io/testing/schema), [linting](https://atlasgo.io/versioned/lint),\nschema [drift detection](https://atlasgo.io/monitoring/drift-detection), and [schema monitoring](https://atlasgo.io/monitoring). It also allows you to extend Sequelize with \nadvanced database objects such as triggers, row-level security, and custom functions that are not supported natively.\n\n### Use-cases\n1. [**Declarative migrations**](https://atlasgo.io/declarative/apply) - Use the Terraform-like `atlas schema apply --env sequelize` command to apply your Sequelize schema to the database.\n2. [**Automatic migration planning**](https://atlasgo.io/versioned/diff) - Use `atlas migrate diff --env sequelize` to automatically plan database schema changes and generate\n   a migration from the current database version to the desired version defined by your Sequelize schema.\n\n### Installation\n\nInstall Atlas from macOS or Linux by running:\n```bash\ncurl -sSf https://atlasgo.sh | sh\n```\nSee [atlasgo.io](https://atlasgo.io/getting-started#installation) for more installation options.\n\nInstall the provider by running:\n```bash\nnpm i @ariga/atlas-provider-sequelize\n```\n\nMake sure all your Node dependencies are installed by running:\n```bash\nnpm i\n```\n\n#### Standalone \n\nIf all of your Sequelize models exist in a single Node module, \nyou can use the provider directly to load your Sequelize schema into Atlas.\n\nIn your project directory, create a new file named `atlas.hcl` with the following contents:\n\n```hcl\ndata \"external_schema\" \"sequelize\" {\n  program = [\n    \"npx\",\n    \"@ariga/atlas-provider-sequelize\",\n    \"load\",\n    \"--path\", \"./path/to/models\",\n    \"--dialect\", \"mysql\", // mariadb | postgres | sqlite | mssql\n  ]\n}\n\nenv \"sequelize\" {\n  src = data.external_schema.sequelize.url\n  dev = \"docker://mysql/8/dev\"\n  migration {\n    dir = \"file://migrations\"\n  }\n  format {\n    migrate {\n      diff = \"{{ sql . \\\"  \\\" }}\"\n    }\n  }\n}\n```\n\n#### As JS Script \n\nIf you want to use the provider as JS script, you can use the provider as follows:\n\nCreate a new file named `load.js` with the following contents:\n\n```js\n#!/usr/bin/env node\n\n// require sequelize models you want to load\nconst user = require(\"./models/user\");\nconst task = require(\"./models/task\");\nconst loadModels = require(\"@ariga/atlas-provider-sequelize\");\n\nconsole.log(loadModels(\"mysql\", user, task));\n```\n\nNext, in your project directory, create a new file named `atlas.hcl` with the following contents:\n\n```hcl\ndata \"external_schema\" \"sequelize\" {\n    program = [\n        \"node\",\n        \"load.js\",\n    ]\n}\n\nenv \"sequelize\" {\n    src = data.external_schema.sequelize.url\n    dev = \"docker://mysql/8/dev\"\n    migration {\n        dir = \"file://migrations\"\n    }\n    format {\n        migrate {\n            diff = \"{{ sql . \\\"  \\\" }}\"\n        }\n    }\n}\n```\n\n### Usage\n\nOnce you have the provider installed, you can use it to apply your Sequelize schema to the database:\n\n#### Apply\n\nYou can use the `atlas schema apply` command to plan and apply a migration of your database to\nyour current Sequelize schema. This works by inspecting the target database and comparing it to the\nSequelize schema and creating a migration plan. Atlas will prompt you to confirm the migration plan\nbefore applying it to the database.\n\n```bash\natlas schema apply --env sequelize -u \"mysql://root:password@localhost:3306/mydb\"\n```\nWhere the `-u` flag accepts the [URL](https://atlasgo.io/concepts/url) to the\ntarget database.\n\n#### Diff\n\nAtlas supports a [version migration](https://atlasgo.io/concepts/declarative-vs-versioned#versioned-migrations) \nworkflow, where each change to the database is versioned and recorded in a migration file. You can use the\n`atlas migrate diff` command to automatically generate a migration file that will migrate the database\nfrom its latest revision to the current Sequelize schema.\n\n```bash\natlas migrate diff --env sequelize \n````\n\n### Typescript\nfor typescript support, see the [ts-atlas-provider-sequelize](https://github.com/ariga/atlas-provider-sequelize/tree/master/ts) README.\n\n### Supported Databases\n\nThe provider supports the following databases:\n* MySQL\n* MariaDB\n* PostgreSQL\n* SQLite\n* Microsoft SQL Server\n\n### Issues\n\nPlease report any issues or feature requests in the [ariga/atlas](https://github.com/ariga/atlas/issues) repository.\n\n### License\n\nThis project is licensed under the [Apache License 2.0](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fariga%2Fatlas-provider-sequelize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fariga%2Fatlas-provider-sequelize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fariga%2Fatlas-provider-sequelize/lists"}