Skip to content

Instantly share code, notes, and snippets.

@criminy
Created November 30, 2011 14:36
Show Gist options
  • Select an option

  • Save criminy/1409272 to your computer and use it in GitHub Desktop.

Select an option

Save criminy/1409272 to your computer and use it in GitHub Desktop.

Revisions

  1. criminy revised this gist Nov 30, 2011. 3 changed files with 13 additions and 15 deletions.
    9 changes: 4 additions & 5 deletions add_ssl.groovy
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,12 @@
    accounts = table("accounts")

    accounts = table('accounts')

    migration('add_ssl') {
    migration("add_ssl") {
    up {
    add_column accounts 'ssl_enabled' Fields.boolean {
    add_column accounts "ssl_enabled" Fields.boolean {
    defaults 1
    }
    }
    down {
    remove_column accounts 'ssl_enabled'
    remove_column accounts "ssl_enabled"
    }
    }
    11 changes: 5 additions & 6 deletions create_accounts.groovy
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,11 @@

    migration('create_accounts') {
    migration("create_accounts") {
    up {
    create_table 'accounts' {
    string 'name'
    string 'password'
    create_table "accounts" {
    string "name"
    string "password"
    }
    }
    down {
    drop_table 'accounts'
    drop_table "accounts"
    }
    }
    8 changes: 4 additions & 4 deletions database.groovy
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    database {
    name 'asdf'
    table_prefix = 'tbl_'
    name "asdf"
    table_prefix = "tbl_"
    migrations {
    ref 'create_accounts'
    ref 'add_ssl'
    ref "create_accounts"
    ref "add_ssl"
    }
    }
  2. criminy created this gist Nov 30, 2011.
    13 changes: 13 additions & 0 deletions add_ssl.groovy
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@

    accounts = table('accounts')

    migration('add_ssl') {
    up {
    add_column accounts 'ssl_enabled' Fields.boolean {
    defaults 1
    }
    }
    down {
    remove_column accounts 'ssl_enabled'
    }
    }
    12 changes: 12 additions & 0 deletions create_accounts.groovy
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@

    migration('create_accounts') {
    up {
    create_table 'accounts' {
    string 'name'
    string 'password'
    }
    }
    down {
    drop_table 'accounts'
    }
    }
    8 changes: 8 additions & 0 deletions database.groovy
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    database {
    name 'asdf'
    table_prefix = 'tbl_'
    migrations {
    ref 'create_accounts'
    ref 'add_ssl'
    }
    }