devsuperstars/migrations

Сreating migrations for a project

1.0.2 2020-01-09 17:50 UTC

This package is auto-updated.

Last update: 2025-04-24 03:50:52 UTC


README

Сreating migrations for a project

migrations can only work with the lipid framework

Quickstart

$ mkdir migrations

$ composer require devsuperstars/migrations

Create your migrations in the directory migrations/ as sql files in order, starting with the number 1.

Example: migrations/1.sql, migrations/2.sql ... migrations/n.sql

SQL file must contain sql-query, for example

ALTER TABLE `db`.`table`
ADD COLUMN `id` INT(11) NOT NULL AUTO_INCREMENT FIRST,
DROP PRIMARY KEY,
ADD PRIMARY KEY (`id`);
}

SQL file can contain multiple sql queries

add to your composer.json scripts

"scripts": {
...
 "migrate": [
      "vendor/bin/migrate"
    ]
}

run migrations:

$ composer migrate