dbup | php simple migration tool | Data Migration library

 by   brtriver PHP Version: Current License: MIT

kandi X-RAY | dbup Summary

kandi X-RAY | dbup Summary

dbup is a PHP library typically used in Migration, Data Migration applications. dbup has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

Dbup is a simple migration tool for PHP. Applied migration sql files are copied to .dbup/applied directory. If a same file exists both sql and .dbup/applied directory, up command ignores this sql file.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              dbup has a low active ecosystem.
              It has 55 star(s) with 19 fork(s). There are 5 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 3 open issues and 2 have been closed. On average issues are closed in 12 days. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of dbup is current.

            kandi-Quality Quality

              dbup has no bugs reported.

            kandi-Security Security

              dbup has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              dbup is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              dbup releases are not available. You will need to build from source code and install.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi has reviewed dbup and discovered the below as its top functions. This is intended to give you an instant insight into dbup implemented functionality, and help decide if they suit your requirements.
            • Execute the command
            • Get up candidates .
            • Get sql status
            • Create a migration .
            • Run up the migrations .
            • Compile databaseup .
            • Configure the database .
            • Get stub .
            • Get PDO connection .
            Get all kandi verified functions for this library.

            dbup Key Features

            No Key Features are available at this moment for dbup.

            dbup Examples and Code Snippets

            No Code Snippets are available at this moment for dbup.

            Community Discussions

            QUESTION

            How to apply EF Core migrations if you should not use MigrateAsync() for production environments?
            Asked 2021-Jun-08 at 11:38

            I created a new .Net 5 project and want to use EF Core. I autogenerated multiple migration.cs files using

            dotnet ef migrations add MyMigration

            and want to apply them (for development and production). I know about the MigrateAsync method so I read about how to call this method on startup

            https://andrewlock.net/running-async-tasks-on-app-startup-in-asp-net-core-part-1/

            but everywhere I read that this method should not be used for production since those migrations won't be executed in a single transaction (no rollback on errors).

            Unfortunately there are not many resources on how to do it regardless of the environment, I found this article

            https://www.thereformedprogrammer.net/handling-entity-framework-core-database-migrations-in-production-part-2

            One option could be a console app calling the migrations

            https://www.thereformedprogrammer.net/handling-entity-framework-core-database-migrations-in-production-part-2/#1b-calling-context-database-migrate-via-a-console-app-or-admin-command

            but I wasn't able to understand the difference for this approach because it's not solving the transactional problem?

            What are best practises to apply migrations during development/production?

            • After autogenerating migrations I'm a big fan of simplicity, does dotnet ef database update the job and I don't need to work with additional tools?

            • Create a console app, generate .sql files from the migrations, install DbUp and use it for the migration part?

            ...

            ANSWER

            Answered 2021-Jun-01 at 23:42

            What works best heavily depends on how deployment pipeline works - how many environments are there before production, release cycle, what parts of deployment are automated. There are no universal "best practices" - each way of handling migrations has its own set of tradeoff to be concious about. Pick upgrade procedure according to what your needs and expectations are.

            When setting up EF Core migrations for a mid-sized project (around 70 tables), I tried out few potential approaches. My observations from the process and what worked out in the end:

            1. You want to get a migration SQL somewhere between changing your models and deploying to production, if only to look at it in case there are any breaking changes that may cause issues on rollback. We decided on having migrations directly in project with dbcontext, and have a migration script (using dotnet ef migrations script --idempotent) be generated for every build that can potentially be deployed to any environment - in our case, a CI step for each push to trunk or release branch.
            2. Putting migration SQL in version control and treating SQL as a source of truth in regards to database structure gives an ability to manually modify scripts when you want to keep some columns for backup or backwards compatibility purposes. Another option would be to consider your data model as a reference for database schema and treat migration SQL as intermediate step that is not preserved, which makes it easier to automate whole process, but requires you to handle special cases directly in your datamodel.
            3. Using --idempotent flag when generating migration script gives you a script you can reapply to a database schema regardless of what schema version it was at, having it execute only steps that were not yet executed. This means you can reapply same migration script to already migrated database without breaking schema. If you have different versions of your application running in parallel in separate environments (development, staging and production environment), it can save issues with tracking manually what migration scripts version you need to apply and in what order.
            4. When you have migration SQL, you can use native for your database tools in order to apply them to target environment - such as sqlcmd for SQL Server, psql for postgres. This also has a benefit of having separate user with higher privileges (schema modification) handle migrations, while your application works on limited privileges, that often can't touch the schema.
            5. Applying database migrations is part of application deployment, not application startup - if you have deployment automation of some sorts, it's probably the best place to put executing migrations against target database, again - database native client is a good alternative to DbUp, pick whichever you prefer. Separating migrations from application startup also gives you ability to run an application against mismatched, but still compatible database schema - which comes handy when e.g. you're doing rollout deployments.
            6. Most problems with schema upgrades come from breaking schema compatibility between versions - avoiding that requires being concious about backwards/forward compatibility when working on data model and splitting breaking changes into separate versions that keep at least single step of backwards/forwards compatibility - whether you need it depends on your project, it's something you should decide on. We run full integration test suite for previous version against current database schema and for current version against previous database schema to make sure no breaking changes are introduced between two subsequent versions - any deployment that moves multiple versions will roll out migrations one by one, with assumption that migration script or application startup can include data transformation from old to new model.

            To sum up: generating migration SQL and using either native tools or DbUp on version deploy gives you a degree of manual control over migration process, and ease of use can be achieved by automating your deployment process. For development purposes, you may as well add automatic migrations on application startup, preferably applied only if environment is set to Development - as long as every person on a team has its own development database (local SQL, personal on a shared server, filedb if you use SQL) there are no conflicts to worry about.

            Source https://stackoverflow.com/questions/67761614

            QUESTION

            Azure Pipeline fails on `dotnet build` with error "command or file was not found"
            Asked 2021-Jun-07 at 01:59

            Recently I had Azure Pipeline builds start failing, without any changes to my build scripts/yaml. The errors are as follows but they're still pretty light on the details.

            ...

            ANSWER

            Answered 2021-Jun-07 at 01:59

            The issue was in fact due to the FscToolPath evaluating to an empty string.

            Existing error message accurately conveys the issue; it’s not F#-specific. Something in the .props/.targets files evaluates to dotnet $(PathToFsc) some/file.rsp and the variable $(PathToFsc) (or whatever is in your build scripts) is evaluating to an empty string. The final command that’s executed is then dotnet some/file.rsp and the normal dotnet behavior is to look for dotnet- as an executable.

            The second factor was that the location of FSC did change due to an update of Visual Studio on the VM Image.

            Not an answer, but I wonder if it's related to this: stackoverflow.com/questions/67800998/… - it seems things may have moved between VS 16.9 and 16.10.

            Finally why it impacted me was because I was setting the FscCompilerPath manually due to a TypeProvider that did not support the dotnet core pipeline due to a dependency on System.Data.SqlClient.

            Source https://stackoverflow.com/questions/67815717

            QUESTION

            Azure search schema migrations
            Asked 2021-Feb-08 at 14:46

            What's the best way to migrate an Azure search schema in a release pipeline?

            In the SQL world, I'd use something like DbUp. Is there anything similar for Azure search? Or is there a different approach when the schema needs to change?

            ...

            ANSWER

            Answered 2021-Feb-08 at 14:46

            It depends on whether you are pushing content via the SDK or if you are pulling content from a supported content source using one of the pre-built indexers. Using the SDK you can add new properties to your model as explained in this post: Update Azure search document schema

            Note: Changes in your data model may require either an update or a rebuild of the index. For example, adding new properties only requires and update. But, if you change a setting like searchable, filterable or sortable you will need a rebuild. For details, see How to rebuild an index in Azure Cognitive Search

            COMPATIBILITY PROBING VIA PUSH

            My preferred solution is to use push indexing for everything. To test if the data model in the index is compatible, I create a sample item and submit to the index. If the model used in the index is incompatible, and error is thrown by the Azure Search SDK. I then delete the index and create it from scratch using my new model.

            Here is a simplified method to test if any item is compatible with a named index:

            Source https://stackoverflow.com/questions/66097334

            QUESTION

            dbup does not create schemaversions table automatically
            Asked 2020-Aug-05 at 11:33

            I installed the latest DbUp version 4.4.0 from nuget and followed the steps described in the docs

            https://dbup.readthedocs.io/en/latest/

            I'm using a MySQL database and created a new .NET Core console project.

            • There is no database present yet. I deleted it

            • I installed the dbup and dbup-mysql package

            • I copied the sample code from the docs and modified it a little bit

              ...

            ANSWER

            Answered 2020-Aug-05 at 11:33

            The table schemaversions was added correctly but the problem is that you drop the database in your initial script. DbUp does not add it again.

            Source https://stackoverflow.com/questions/63220911

            QUESTION

            Azure Devops YAML pipeline - how to repeat a task
            Asked 2020-Apr-24 at 01:46

            In my YAML pipeline I have a deployment job:

            ...

            ANSWER

            Answered 2020-Apr-24 at 01:46

            I can't test UpdateDatabaseWithDbUp@2 but I have sth what explain how you can achieve your goal. First define templeate.yaml

            Source https://stackoverflow.com/questions/61398206

            QUESTION

            Using DBup with octopus deploy error, (System.Data.SqlClient is not supported on this platform.)
            Asked 2020-Mar-19 at 17:51

            I'm using .net core 2.1 project with DBUP library, but when I try to run the DBUP inside octopus deploy the migration tool is returning an error System.Data.SqlClient is not supported on this platform.

            I followed all these steps from an Octopus Documentations https://octopus.com/blog/dbup-database-deployments...

            Already did this steps to fix the problem but without success:

            • net core SDK 2.1, 2.2 installations on the target server
            • Restart the server
            • New release with System.Data.SqlClient nuget package associated with the DBUP Project

            Not sure what I can do more to fix this issue

            ...

            ANSWER

            Answered 2020-Mar-19 at 17:51

            Found the problem, DBUP project needs to be published isolated from other projects.

            My bad was, trying to run/use dbupproject.dll file as a reference from other projects.

            Source https://stackoverflow.com/questions/60723527

            QUESTION

            "EnsureDatabase" fails the first time with: "Database not found on server with connection string in settings"
            Asked 2020-Feb-22 at 23:16

            I am trying to use DbUp to set up migration scripts for my Database. Problem is whenever I use:

            ...

            ANSWER

            Answered 2020-Feb-22 at 23:16

            Problem happens with 4.3.0 release. Downgrade to 4.0.0 and it won't happen anymore (as a temporary fix till a stable one)

            Source https://stackoverflow.com/questions/60247206

            QUESTION

            C# + DockerCompose - Wait for MS SQL Server Docker container to be up before trying to connect
            Asked 2019-Dec-16 at 15:34

            I am trying to create integration tests for my microservices similar to Spotify's approach.

            I am still working on how to spin up and seed the database. Currently I have a .NET Core 2.0 project with FluentDocker v2.2.15 and DbUp 4.1.0.

            I use FluentDocker to call DockerCompose and start my services, including the SQL Server container

            ...

            ANSWER

            Answered 2018-Oct-03 at 18:49

            You can use WaitForPort, WaitForProcess, WaitForHttp, or custom lambda Wait functions on compose in FluentDocker v2.6.2. For example:

            Given the docker-compose file:

            Source https://stackoverflow.com/questions/50877625

            QUESTION

            .net core "dotnet run" command don't breake Azure buid pipeline (bash) on error
            Asked 2019-Jul-12 at 12:45

            Running an Azure (CentOS 7 client) build pipeline with a command

            # Run DB migrations dotnet run --project $(Build.Repository.LocalPath)/DBMigrations

            this job is shown as completed successfully, although there was an exception System.Data.SqlClient.SqlException and I used

            failOnStderr: true in my pipeline configuration.

            Migrations code:

            ...

            ANSWER

            Answered 2019-Jul-12 at 12:45

            QUESTION

            Getting 'relation "schemaversions" does not exist error'
            Asked 2019-May-26 at 19:03

            Im trying to use the example code from dbup converted to postgres.

            Below is the code.

            ...

            ANSWER

            Answered 2019-May-26 at 19:03

            I know this is an old question but today I ran into the same problem and since there is no answer yet I'm answering for future reference:

            I found that DbUp is trying to create a "schemaversions" but there is no default schema set. This results in the error:

            Getting 'relation "schemaversions" does not exist error'

            Setting the default schema fixed the problem for me:

            builder.JournalToPostgresqlTable("SCHEMA_NAME", "schemaversions")

            Source https://stackoverflow.com/questions/53420121

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install dbup

            Installing Dbup is as easy as it can get. Download the [dbup.phar][1] and run init, then .dbup and sql directory are created and set a sample properties.ini file and sqlfile. change the database config in .dbup/properties.ini. You can also assign environment variables to your database configuration file. Dbup reads DBUP_ prefixed environment variables if the names are placed in .ini file with surrounded %%. For example, user parameter of the following ini will be replaced to a value of the environment variable DBUP_USERNAME if it is defined.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/brtriver/dbup.git

          • CLI

            gh repo clone brtriver/dbup

          • sshUrl

            git@github.com:brtriver/dbup.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Data Migration Libraries

            Try Top Libraries by brtriver

            karen

            by brtriverPHP

            MameForm

            by brtriverPHP

            silex-doc-ja

            by brtriverHTML

            silex-react-sample

            by brtriverPHP