{"id":21404712,"url":"https://github.com/eightyfive/laravel-exodus","last_synced_at":"2025-07-13T23:30:24.820Z","repository":{"id":56980748,"uuid":"261080852","full_name":"eightyfive/laravel-exodus","owner":"eightyfive","description":"Laravel YAML migrations","archived":false,"fork":false,"pushed_at":"2023-06-09T09:17:37.000Z","size":116,"stargazers_count":8,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-02T11:03:14.977Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eightyfive.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":"2020-05-04T04:32:43.000Z","updated_at":"2024-09-14T21:04:59.000Z","dependencies_parsed_at":"2024-11-22T16:17:49.278Z","dependency_job_id":"d3f64813-badb-415f-b11a-deee3a8a1cb3","html_url":"https://github.com/eightyfive/laravel-exodus","commit_stats":{"total_commits":56,"total_committers":3,"mean_commits":"18.666666666666668","dds":0.375,"last_synced_commit":"3e6e3b35bcaf31f5d10691fe1610c4afe4b4065f"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/eightyfive/laravel-exodus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eightyfive%2Flaravel-exodus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eightyfive%2Flaravel-exodus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eightyfive%2Flaravel-exodus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eightyfive%2Flaravel-exodus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eightyfive","download_url":"https://codeload.github.com/eightyfive/laravel-exodus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eightyfive%2Flaravel-exodus/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265220045,"owners_count":23729748,"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":[],"created_at":"2024-11-22T16:17:41.162Z","updated_at":"2025-07-13T23:30:24.563Z","avatar_url":"https://github.com/eightyfive.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# laravel-exodus\n\nConverts YAML to actual Laravel migration files.\n\n## Install\n\n```bash\ncomposer require --dev eyf/laravel-exodus\n```\n\n## Usage\n\n### Step 1: Create `database/migrations.yaml` file\n\nDefine a `posts` table:\n\n```yaml\n# database/migrations.yaml\n\nposts:\n    id: true\n    timestamps: true\n    softDeletes: true\n    slug: string(100).unique\n    title: string\n    content: text\n    excerpt: string.nullable\n    author_id: foreignId.constrained('users')\n```\n\n### Step 2: Make migrations (command)\n\nRun `exodus` command to translate the `yaml` file into actual Laravel migration files:\n\n```bash\nphp artisan exodus\n\nCreated Migration: 2020_05_05_100005_create_posts_table\n```\n\n### Step 3: `migrate` as normal\n\n```bash\nphp artisan migrate\n```\n\n## Workflow\n\nExodus is a DEV package, it is meant to ease / speed up development time.\n\nA normal workflow while DEV'ing could be:\n\n1. Create `migrations.yaml` file (Add a `posts` table)\n2. `php artisan exodus`\n3. `php artisan migrate`\n4. Edit `migrations.yaml` file (Add a `users` table)\n5. `php artisan exodus`\n6. `php artisan migrate:refresh (--seed)`\n7. Edit `migrations.yaml` file\n8. ... (Repeat)\n\n### The `exodus.lock` file\n\nBy default the migration file names won't change between multiple `exodus` runs.\n\nThis is because Exodus keeps track of the initial migration file name in `database/exodus.lock` (to commit in your repository).\n\nThis makes sure `git` sees the edits in the same migration file throughout the whole DEV.\n\n### The `force` option\n\nSometimes you may want to bypass the `exodus.lock` file (For example when you want to change the table order creation).\n\n```bash\nphp artisan exodus --force\n```\n\nWhat happens:\n\n1. All \"old\" migration files will be deleted (the ones in current `exodus.lock`)\n2. New migration files will be generated (with newest date in filename)\n\n## Syntax\n\n### Column\n\nAny column can be written fluently exactly like in the Laravel migration syntax. In fact Exodus is just a light translator of a \"dot notation\" `array` to the actual PHP syntax.\n\n```yaml\nmy_table:\n    my_column_name: string(50).nullable.unique\n```\n\n### Special column\n\nSpecial column types are the \"sugar\" methods provided by Laravel for a better developer experience: `id()`, `timestamps()`, `softDeletes()`, `rememberToken()`, etc...\n\nSince these column types don't have a column name (name is in the convention), just specify `true` as their value:\n\n```yaml\nmy_table:\n    id: true\n    timestamps: true\n    softDeletes: true\n```\n\n### Pivot tables\n\nFor generating a pivot table, just use two table names as follow:\n\n```yaml\nusers:\n    id: true\n    name: string\n\nposts:\n    id: true\n    title: string\n\n\"@users @posts\": []\n```\n\nThis will create the following pivot migration file:\n\n```php\n\u003c?php\n// database/migrations/2020_05_05_085245_create_post_user_pivot_table.php\n\nclass CreatePostUserPivotTable extends Migration\n{\n    public function up()\n    {\n        Schema::create(\"post_user\", function (Blueprint $table) {\n            $table\n                -\u003eforeignId(\"post_id\")\n                -\u003eindex()\n                -\u003econstrained();\n            $table\n                -\u003eforeignId(\"user_id\")\n                -\u003eindex()\n                -\u003econstrained();\n            $table-\u003eprimary([\"post_id\", \"user_id\"]);\n        });\n    }\n\n    public function down()\n    {\n        Schema::dropIfExists(\"post_user\");\n    }\n}\n```\n\nYou can even provide more columns to the pivot table as normal:\n\n```yaml\n\"@users @posts\":\n    timestamps: true\n    approved_by: foreignId.nullable.constrained('users')\n    approved_at: timestamp.nullable\n```\n\n## Phylosophy\n\nThis package aims at speedind up development time. It is not meant to be used after you have launched to production. In fact the package does not provide a way to run migrations for adding or removing columns (it used to).\n\nThis is by choice.\n\nWhile DEV'ing you should edit the `migrations.yaml` file as much as you want and run `migrate:refresh (--seed)` as often as possible. \"This is the way\".\n\nBy the time you are happy with your Schema, you must have launched in production, and then only you may create normal Laravel migration files for adding or removing column(s) in your tables. This is where the job of this package ends.\n\nTODO: Implement safety guard making sure `exodus` cannot be run if it detects more migrations files than in `exodus.lock`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feightyfive%2Flaravel-exodus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feightyfive%2Flaravel-exodus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feightyfive%2Flaravel-exodus/lists"}