{"id":26791653,"url":"https://github.com/trustbit/PlainSql.Migrations","last_synced_at":"2025-03-29T15:16:52.946Z","repository":{"id":41852602,"uuid":"65299277","full_name":"trustbit/PlainSql.Migrations","owner":"trustbit","description":"Executes migration scripts written in plain old SQL","archived":false,"fork":false,"pushed_at":"2025-01-21T09:30:21.000Z","size":84,"stargazers_count":7,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T15:16:48.572Z","etag":null,"topics":["database","dotnet-core","migrations","sql"],"latest_commit_sha":null,"homepage":"","language":"C#","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/trustbit.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2016-08-09T13:57:07.000Z","updated_at":"2025-01-21T09:30:25.000Z","dependencies_parsed_at":"2024-06-21T14:28:24.042Z","dependency_job_id":null,"html_url":"https://github.com/trustbit/PlainSql.Migrations","commit_stats":null,"previous_names":["softwarepark/plainsql.migrations"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trustbit%2FPlainSql.Migrations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trustbit%2FPlainSql.Migrations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trustbit%2FPlainSql.Migrations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trustbit%2FPlainSql.Migrations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trustbit","download_url":"https://codeload.github.com/trustbit/PlainSql.Migrations/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246200326,"owners_count":20739568,"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":["database","dotnet-core","migrations","sql"],"created_at":"2025-03-29T15:16:52.024Z","updated_at":"2025-03-29T15:16:52.940Z","avatar_url":"https://github.com/trustbit.png","language":"C#","readme":"# PlainSql.Migrations\n\n![Build Status](https://github.com/trustbit/PlainSql.Migrations/actions/workflows/test.yml/badge.svg?branch=master)\n[![Coverage Status](https://coveralls.io/repos/github/trustbit/PlainSql.Migrations/badge.svg?branch=master)](https://coveralls.io/github/trustbit/PlainSql.Migrations?branch=master)\n\nExecute migration scripts written in plain old SQL. Only executes each migration once.\n\n## Installation\n\n```bash\ndotnet add package PlainSql.Migrations\n```\n\n## Usage\n\n`PlainSql.Migrations` provide a script loader and a migrator that interact to load and execute migration scripts.\n\n```csharp\nusing PlainSql.Migrations;\n\nprivate void ExecuteMigrations(string connectionString, string environment)\n{\n    using (var connection = new SqlConnection(connectionString))\n    {\n        connection.Open();\n\n        var migrationScripts = MigrationScriptsLoader.FromDirectory(\"./MigrationScripts\");\n\n        Migrator.ExecuteMigrations(connection, migrationScripts);\n\n        Console.Writeline(\"Executed database migration scripts\");\n    }\n}\n```\n\n`MigrationScriptsLoader.FromDirectory` orders the migration scripts alphabetically\n(using `System.StringComparer.InvariantCulture`).\n\n## Global Tool\n\n`PlainSql.Migrations` offers a .NET Global tool that can be installed like\nso `dotnet tool install --global PlainSql.Migrations.Tool` and then executed from the terminal like\nso `migrate -c \"Uid=myuser;Pwd=password1;Host=localhost;Database=northwind;\" -d postgres`.\n\n## Creating Migration Files\n\n`PlainSql.Migrations` also includes a .NET Global tool to generate timestamped migration files in the format\nof `yyyyMMddHHmmss_DescriptionOfTheMigration.sql`. \n\n### Usage\n\n#### Installation\n\nInstall with `dotnet tool install --global PlainSql.Migrations.Generator`.\n\n#### Generating Files\nUse the `generate-migration` command.\n\n```\n$ generate-migration \"add phone number to user table\"\n[10:42:21 INF] Creating migration file 20230302104221_AddPhoneNumberToUserTable.sql in ./MigrationScripts\n[10:42:21 INF] Sucessfully created 20230302104221_AddPhoneNumberToUserTable.sql!\n```\n\nA different location for the migration scripts folder can be supplied with the `-m` option:\n```\n$ generate-migration \"add phone number to user table\" -m \"./migrations\"\n[10:44:54 INF] Creating migration file 20230302104454_AddPhoneNumberToUserTable.sql in ./migrations\n[10:44:54 INF] Sucessfully created 20230302104454_AddPhoneNumberToUserTable.sql!\n```\n\n## Database Support\n\n* SQLite\n* MS SQL\n* PostgreSQL\n\n## Concurrency\n\nMigrations are executed in a single transaction with isolation level \"Serializable\". This usually\nmeans that executing migrations is concurrency-safe. For details on which SQL statements are supported\nby this transaction level, please refer to the documentation of your database technology.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrustbit%2FPlainSql.Migrations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrustbit%2FPlainSql.Migrations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrustbit%2FPlainSql.Migrations/lists"}