Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 55 lines (39 sloc) 2.589 kB
2196e7a fixed case where index of one table flows over to other; added schema…
unknown authored
1 Ruby on Rails-like database migration management for PHP
2 http://github.com/nickinuse/php-migrations
3
13d2823 @nickinuse some sort of licence
authored
4 some (c) 2009/2010 nickinuse@ofmy.info
5 free to share, remix, use in commercial projects, with ot without attribution
6 as long as the source is treated AS-IS without expecting any specific support ;)
7
2196e7a fixed case where index of one table flows over to other; added schema…
unknown authored
8 WARNING
9
10 Source provided AS-IS and subject to changes, it's advised to test migrations on a temporary database for now.
11
12 DESCRIPTION
13
14 The main aim of this project is to provide PHP developers with means of creating
15 non-SQL based migrations and tools to maintain database changes between developers/
16 different project servers/sandboxes and database adaptors.
17
18 Whilst there already exist classes and tools for maintaining migrations in PHP,
19 very few of them can generate SQL changes through php functions (or do so through
20 awfully long class/function names). It was my aim to port most of the syntax and
21 functionality from RoR, being the main pioneer of migration-based approach.
22
23 WHAT IS A DATABASE MIGRATION?
24
25 A migration is a description of changes made to the database [provided in
26 the up() method] and means to revert them [provided in the down() method].
27 Migrations allow to automate the tedious process of maintaining the current
28 state of the database between developers/database interfaces, keep track of changes
29 made (with means to undo them if required), make experimenting easy.
30
31 FEATURES
32
33 * generic helper functions for database independent SQL generation
34 (e.g. create_table, t_[basic type] for columns etc.; see db methods)
35 * command-line management
36 * timestamp-based migration file naming: avoid conflicts between developers
37 * transaction-based migration execution: prevent erroneous changes to succeed
38 * migration version is stored in a file, which allows easy transfer of migration setup
fbd05d9 @nickinuse readme change from version.php to schema.php
authored
39 (note: you should exclude/ignore schema.php from sandbox repositories)
2196e7a fixed case where index of one table flows over to other; added schema…
unknown authored
40 * open-ended and flexible: provides means to allow for different database adapters,
41 convenient ways to specify function parameters (NB: adaptor implementations are welcome)
42
43 INSTALLATION/USE
44
6d6c5ce @nickinuse corrected readme
authored
45 rename/copy config.sample.php to config.php and modify it as prompted in comments
2196e7a fixed case where index of one table flows over to other; added schema…
unknown authored
46
47 to get started, launch a console in the directory containing migrate.php and launch:
48 php -f migrate.php help
49 or use the provided convenience shell script
50 db help
51
6d6c5ce @nickinuse corrected readme
authored
52 If wanting to share with another developer, you should ignore schema/ folder or schema.php directly.
8f28fef @nickinuse readme note to unignore migrate/*
authored
53
2196e7a fixed case where index of one table flows over to other; added schema…
unknown authored
54 Have a look at some documentation: http://wiki.github.com/nickinuse/php-migrations
Something went wrong with that request. Please try again.