github.com/marinho/drone@v0.2.1-0.20140504195434-d3ba962e89a7/pkg/database/migrate/20140310104446_add_open_invitation_column.go (about)

     1  package migrate
     2  
     3  type rev20140310104446 struct{}
     4  
     5  var AddOpenInvitationColumn = &rev20140310104446{}
     6  
     7  func (r *rev20140310104446) Revision() int64 {
     8  	return 20140310104446
     9  }
    10  
    11  func (r *rev20140310104446) Up(mg *MigrationDriver) error {
    12  	// Suppress error here for backward compatibility
    13  	_, err := mg.AddColumn("settings", "open_invitations BOOLEAN")
    14  	_, err = mg.Tx.Exec("UPDATE settings SET open_invitations=0 WHERE open_invitations IS NULL")
    15  	return err
    16  }
    17  
    18  func (r *rev20140310104446) Down(mg *MigrationDriver) error {
    19  	_, err := mg.DropColumns("settings", "open_invitations")
    20  	return err
    21  }