GithubHelp home page GithubHelp logo

kohana-3-migrations's Introduction

About

This Kohana module provides simple migrations from the command line for SQL compliant databases.

It is a K3 port of http://github.com/jmhobbs/kohana-2-migrations

Using

Create a folder named "migrations" in your application folder. This directory must be writable, or must contain a directory called ".info" which is writable.

Put valid SQL files in that folder, following the naming patterns: 001_ANYTHING_HERE_UP.sql & 001_ANYTHING_HERE_DOWN.sql

For example:

001_Auth_DOWN.sql
001_Auth_UP.sql
002_Users_DOWN.sql
002_Users_UP.sql
003_Island_DOWN.sql
003_Island_UP.sql
004_Pages_DOWN.sql
004_Pages_UP.sql

Now add this module to your application/bootstrap.php file.

Then you can run them from the command line:

Status

jmhobbs@katya:/var/www/qaargh$ php5 index.php --uri=migrations

=======================[ Kohana Migrations ]=======================

    Current Migration: 7
     Latest Migration: 7

===================================================================

Up

jmhobbs@katya:/var/www/qaargh$ php5 index.php --uri=migrations/up/3

=======================[ Kohana Migrations ]=======================

   Current Migration: 0
    Latest Migration: 7

===================================================================

  Requested Migration: 3
            Migrating: UP

===================================================================

Migrated: 001_Auth_UP.sql
Migrated: 002_Users_UP.sql
Migrated: 003_Island_UP.sql

===================================================================

    Current Migration: 3
     Latest Migration: 7

===================================================================

Down

jmhobbs@katya:/var/www/qaargh$ php5 index.php --uri=migrations/down/0

=======================[ Kohana Migrations ]=======================

    Current Migration: 3
     Latest Migration: 7

===================================================================

  Requested Migration: 0
            Migrating: DOWN

===================================================================

Migrated: 003_Island_DOWN.sql
Migrated: 002_Users_DOWN.sql
Migrated: 001_Auth_DOWN.sql

===================================================================

    Current Migration: 0
     Latest Migration: 7

===================================================================

Authors

License

Copyright (c) 2010-2012

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Inspiration

Inspiration and base code from https://code.google.com/p/kohana-migrations/

kohana-3-migrations's People

Contributors

jmhobbs avatar dubbs avatar

Stargazers

 avatar Vasili Khlystou avatar Recca Tsai avatar Sandeep Sangamreddi avatar  avatar Bartłomiej Kuleszewicz avatar Evgeny Kovalev avatar Matt Oakley avatar Igor Skrynkovskyy avatar Maciek Lamberski avatar Brian Wisti avatar Jonathan Reyes avatar  avatar Richard Willis avatar Paul (xobb) Chubatyy avatar Phil Sturgeon avatar Paul Dixon avatar James Fountain avatar Michael Lavers avatar

Watchers

 avatar  avatar James Cloos avatar Tarsis Lima avatar

kohana-3-migrations's Issues

.sql files are weak

Hey,

Although this is awesome code, basing your migrations around .sql files is a bit weak. In Rails, CodeIgniter and Fuel migrations are done with .rb or .php files, which means you can run SQL and any other code too.

For example, if I add a new column to a table and my model or controller is expecting that value, I'll need to clear the cache to stop a PHP errors popping up. This is only one of several possible examples.

Run a PHP file and you can do lots more. :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.