example/readme-example/migration/1398228686331.createInitialTables.js
function (db) {
        //create a table called state;
        return db
            .createTable("state", function () {
                this.primaryKey("id");
                this.name(String);
                this.population("integer");
                this.founded(Date);
                this.climate(String);
                this.description("text");
            })
            .chain(function () {
                //create another table called capital
                return db.createTable("capital", function () {
                    this.primaryKey("id");
                    this.population("integer");
                    this.name(String);
                    this.founded(Date);
                    this.foreignKey("stateId", "state", {key: "id", onDelete: "CASCADE"});
                });
            });
    }
function (db) {
        //create a table called state;
        return db
            .createTable("state", function () {
                this.primaryKey("id");
                this.name(String);
                this.population("integer");
                this.founded(Date);
                this.climate(String);
                this.description("text");
            })
            .chain(function () {
                //create another table called capital
                return db.createTable("capital", function () {
                    this.primaryKey("id");
                    this.population("integer");
                    this.name(String);
                    this.founded(Date);
                    this.foreignKey("stateId", "state", {key: "id", onDelete: "CASCADE"});
                });
            });
    }
function ( db ) { //create a table called state; return db . createTable ( "state" , function ( ) { this . primaryKey ( "id" ) ; this . name ( String ) ; this . population ( "integer" ) ; this . founded ( Date ) ; this . climate ( String ) ; this . description ( "text" ) ; } ) . chain ( function ( ) { //create another table called capital return db . createTable ( "capital" , function ( ) { this . primaryKey ( "id" ) ; this . population ( "integer" ) ; this . name ( String ) ; this . founded ( Date ) ; this . foreignKey ( "stateId" , "state" , { key : "id" , onDelete : "CASCADE" } ) ; } ) ; } ) ; }
up is called when you migrate your database up
up is called when you migrate your database up