migrations.go 800 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package migrations
  2. var migrationList []*migration
  3. func init() {
  4. new(migrationBuilder).
  5. // ------------------------------
  6. desc("Create account table").
  7. sqlite(`
  8. CREATE TABLE account (
  9. id INTEGER PRIMARY KEY AUTOINCREMENT
  10. )
  11. `).
  12. mysql(`
  13. CREATE TABLE account (
  14. id BIGINT NOT NULL AUTO_INCREMENT, PRIMARY KEY (id)
  15. )
  16. `).
  17. verifyTable("account").add()
  18. // ------------------------------
  19. // desc("Add name column to account table").
  20. // table("account").addColumn("name").colType(DB_TYPE_STRING)
  21. // sqlite("ALTER TABLE account ADD COLUMN name TEXT").
  22. // mysql("ALTER TABLE account ADD COLUMN name NVARCHAR(255)").
  23. }
  24. type SchemaVersion struct {
  25. Version int
  26. }
  27. type SchemaLog struct {
  28. Id int64
  29. Version int64
  30. Desc string
  31. Info string
  32. Error bool
  33. }