2017 © Pedro Peláez
 

library autoparis

Automated scheme creator & updater integrated and built for idiorm & paris. Currenlty works only with MySQL

image

shadowprince/autoparis

Automated scheme creator & updater integrated and built for idiorm & paris. Currenlty works only with MySQL

  • Friday, January 17, 2014
  • by ShadowPrince
  • Repository
  • 2 Watchers
  • 3 Stars
  • 32 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

AutoParis

Autoparis is a library, that extends j4mie's paris ORM for automated scheme creation and keeping it up to date., (*1)

How to use it?

Installing

Autoparis can be simply installed by composer, actual install information you can found at page on packagist., (*2)

Requirements

  1. Model should extend \Autoparis\AutoModel and provide public ( non static ) method getFields(). It should return array of instances of \Autoparis\Field or classes extending it.
  2. public static $_field of every model should be setted up.
  3. You should provide lookup_models() function in bin/autoparis.php, that'll return array of models classes
  4. And you should properly configure idiorm when you start autoparis (you can get trough it simply including your project boostrap, that will call ORM::configure's)

Usage

Autoparis is a cli-tool, located in bin/autoparis.php. You can get help trough --help. Autoparis has behavior like django's tool. By default, autoparis will update all schemes for models returned by lookup_models() Like django, autoparis will not modify your tables if you dont provide --force option, because that action can damage data, so dont run it on production databases., (*3)

Documentation

There is documentation, that covers few topics that might be unclear and usefull., (*4)

Examples

// model class
class User extends \Autoparis\AutoModel {
    public static $_table = 'users';

    public function getFields() {
        return [
            new \Autoparis\Int("id", ["nn" => true]),
            new \Autoparis\Varchar("username", 32),
            new \Autoparis\Varchar("password"", 32),
            new \Autoparis\DateTime("joined", ["default" => "now"])
        ];
    }

// in autoparis.php
ORM::configure(...);

function lookup_models() {
    return ["\User"];
}

$ ./autoparis.php
    Processing \User...
    Up to date.
mysql [db]> show columns from users;
    +----------+-------------+------+-----+---------+-------+
    | Field    | Type        | Null | Key | Default | Extra |
    +----------+-------------+------+-----+---------+-------+
    | id       | int(11)     | NO   |     | NULL    |       |
    | username | varchar(32) | YES  |     | NULL    |       |
    | password | varchar(32) | YES  |     | NULL    |       |
    | joined   | datetime    | YES  |     | NULL    |       |
    +----------+-------------+------+-----+---------+-------+

The Versions

17/01 2014

dev-master

9999999-dev http://shadowprince.github.com/autoparis

Automated scheme creator & updater integrated and built for idiorm & paris. Currenlty works only with MySQL

  Sources   Download

BSD

The Requires

 

orm addon idiorm paris

17/11 2013

0.1.3

0.1.3.0 http://shadowprince.github.com/autoparis

Automated scheme creator & updater integrated and built for idiorm & paris. Currenlty works only with MySQL

  Sources   Download

BSD

The Requires

 

orm addon idiorm paris

22/10 2013

0.1.1

0.1.1.0 http://shadowprince.github.com/autoparis

Automated scheme creator & updater integrated and built for idiorm & paris. Currenlty works only with MySQL

  Sources   Download

BSD

The Requires

 

orm addon idiorm paris

22/10 2013

0.1.2

0.1.2.0 http://shadowprince.github.com/autoparis

Automated scheme creator & updater integrated and built for idiorm & paris. Currenlty works only with MySQL

  Sources   Download

BSD

The Requires

 

orm addon idiorm paris

15/10 2013

0.1

0.1.0.0 http://shadowprince.github.com/autoparis

Automated scheme creator & updater integrated and built for idiorm & paris. Currenlty works only with MySQL

  Sources   Download

BSD

The Requires

 

orm addon idiorm paris