Download the PHP package bowlofsoup/couchbase-migrations-bundle without Composer

On this page you can find all versions of the php package bowlofsoup/couchbase-migrations-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package couchbase-migrations-bundle

Couchbase Migrations Bundle

With this Symfony bundle you can generate and execute migrations on a Couchbase database. It works kind of like Doctrine Migrations.

Prerequisites

Installation and setup

Install the bundle via composer.

composer require bowlofsoup/couchbase-migrations-bundle

Add the bundle to your AppKernel.php.

$bundles = [
    ...
    new \BowlOfSoup\CouchbaseMigrationsBundle\CouchbaseMigrationsBundle()
    ...
];

Create a CouchbaseMigrations directory in your app directory. This will contain all the generated blank migrations.

$ mkdir CouchbaseMigrations

Add the config/packages/couchbase_migrations_bundle.yaml.

couchbase_migrations:
    host: '%env(COUCHBASE_MIGRATIONS_HOST)%'
    user: '%env(COUCHBASE_MIGRATIONS_USER)%'
    password: '%env(COUCHBASE_MIGRATIONS_PASSWORD)%'
    bucket_migrations: '%env(COUCHBASE_MIGRATIONS_BUCKET_MIGRATIONS)%'
    bucket_default: '%env(COUCHBASE_MIGRATIONS_DEFAULT_BUCKET)%'

Optional you can also configure the port if it is not standard.

couchbase_migrations:
    port: '%env(COUCHBASE_MIGRATIONS_PORT)%'

In your .env file, define the above values:

COUCHBASE_MIGRATIONS_HOST="127.0.0.1"
COUCHBASE_MIGRATIONS_USER="couchbase_user"
COUCHBASE_MIGRATIONS_PASSWORD="couchbase_password"
COUCHBASE_MIGRATIONS_BUCKET_MIGRATIONS="default"
COUCHBASE_MIGRATIONS_DEFAULT_BUCKET="default"

Usage

Generate migration

bin/console couchbase:migrations:generate

This will generate a blank migration file in CouchbaseMigrations/ for you to fill.

Migrate all

bin/console couchbase:migrations:migrate

This will execute all migrations that still need to be done.

The configured bucket (bucket_migrations in the config file) will contain a document (migrations::versions) which contains the already migrated.

Execute a single migration

bin/console couchbase:migrations:execute VERSION_NUMBER [--no-verbose] [--down]

This will execute the given version (file in CouchbaseMigrations/). Replace VERSION_NUMBER with the version (date-time part of the file) you want to execute. You can execute a version indefinitely: will not be kept track of.

Flush all data in a bucket, except the migrations

bin/console couchbase:migrations:flush-data BUCKET_NAME

Flushes all the data in a bucket, if flushing is enabled for that bucket, except the migrations version document. Replace BUCKET_NAME with the name of the bucket for which you want the data to be flushed. Defaults to the configured bucket.

Can be handy if you want to reset all data in a bucket, but do not want to lose your migrations.

Create a bucket

bin/console couchbase:migrations:create-bucket [BUCKET_NAME] [--index]

Creates a bucket, optional name (takes default configured) and optionally creating a primary index.

Remove a bucket

bin/console couchbase:migrations:remove-bucket [BUCKET_NAME]

Creates a bucket, optional name (takes default configured).

How to write a migration

When you have generated a migration, open the file and use the up function. Example:

or

Downgrading is also supported for the execute command, just add a method down() to the migration.

So:

Note: The Bucket returned by selectBucket() and the result returned by $bucket->get() are both small backwards- compatible classes to not break old migrations defined with the previous version of this bundle. If you need the actual Couchbase Bucket, you can use $bucket->getBucket(), if you need the actual Couchbase result you can get that by calling $result->getResult().

How to use as standalone application

You can use this bundle as standalone application, so, not use it within a Symfony installation. This is also perfect for development.

Fill the src/app/parameters.yml file with:

parameters:
  kernel.project_dir:

  couchbase_bucket:

  couchbase_migrations.bucket_migrations:
  couchbase_migrations.host:
  couchbase_migrations.user:
  couchbase_migrations.password:

Contributing

You are more then welcome to fork this repository, make changes and create a pull request back.

Upgrading to 2.x

When you're upgrading from version 1.0, you need to do two things:


All versions of couchbase-migrations-bundle with dependencies

PHP Build Version
Package Version
Requires ext-couchbase Version *
php Version >=8.3
symfony/console Version ^7.0
symfony/dependency-injection Version ^7.0
symfony/process Version ^7.0
symfony/config Version ^7.0
symfony/http-kernel Version ^7.0
symfony/yaml Version ^7.0
couchbase/couchbase Version ^4.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bowlofsoup/couchbase-migrations-bundle contains the following files

Loading the files please wait ....