Last active
December 27, 2015 07:09
-
-
Save ToQoz/7287244 to your computer and use it in GitHub Desktop.
どっちがだるいか分からなくなってきた
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP TABLE posts; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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