Skip to content

Instantly share code, notes, and snippets.

@ToQoz
Last active December 27, 2015 07:09
Show Gist options
  • Save ToQoz/7287244 to your computer and use it in GitHub Desktop.
Save ToQoz/7287244 to your computer and use it in GitHub Desktop.
どっちがだるいか分からなくなってきた
package migrations
import (
"github.com/ToQoz/scheman"
)
type createPost struct {}
func (c *createPost) up(migrator *scheman.Migrator) {
migrator.CreateTable("posts", func(table *scheman.Table) {
table.AddColumn("id", "int(32)", "NOT NULL PRIMARY KEY AUTOINCREMENT")
table.AddColumn("title", "varchar(32)", "NOT NULL")
})
}
func (c *createPost) down(migrator *scheman.Migrator) {
migrator.DropTable("posts")
}
scheman.appendMigration(createPost)
CREATE TABLE posts (
id int(32) NOT NULL PRIMARY KEY AUTOINCREMENT,
title varchar(32) NOT NULL
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment