000000014.go 839 B

123456789101112131415161718192021222324252627282930313233
  1. package migrate
  2. import (
  3. "context"
  4. "golang-fave/engine/sqlw"
  5. )
  6. func Migrate_000000014(ctx context.Context, db *sqlw.DB, host string) error {
  7. // Table: notify_mail
  8. if _, err := db.Exec(
  9. ctx,
  10. `CREATE TABLE notify_mail (
  11. id int(11) NOT NULL AUTO_INCREMENT COMMENT 'AI',
  12. email varchar(255) NOT NULL COMMENT 'Email address',
  13. subject varchar(800) NOT NULL COMMENT 'Email subject',
  14. message text NOT NULL COMMENT 'Email body',
  15. error text NOT NULL COMMENT 'Send error message',
  16. datetime datetime NOT NULL COMMENT 'Creation date/time',
  17. status int(1) NOT NULL COMMENT 'Sending status',
  18. PRIMARY KEY (id)
  19. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;`,
  20. ); err != nil {
  21. return err
  22. }
  23. // Indexes
  24. if _, err := db.Exec(ctx, `ALTER TABLE notify_mail ADD KEY status (status);`); err != nil {
  25. return err
  26. }
  27. return nil
  28. }