···600 return nil
601 })
6020000000000000000000000603 // recreate and add rkey + created columns with default constraint
604 runMigration(db, "rework-collaborators-table", func(tx *sql.Tx) error {
605 // create new table
···600 return nil
601 })
602603+ // make registrations.secret nullable for unified registration flow
604+ runMigration(db, "make-registrations-secret-nullable", func(tx *sql.Tx) error {
605+ // sqlite doesn't support ALTER COLUMN, so we need to recreate the table
606+ _, err := tx.Exec(`
607+ create table registrations_new (
608+ id integer primary key autoincrement,
609+ domain text not null unique,
610+ did text not null,
611+ secret text,
612+ created text not null default (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
613+ registered text
614+ );
615+616+ insert into registrations_new (id, domain, did, secret, created, registered)
617+ select id, domain, did, secret, created, registered from registrations;
618+619+ drop table registrations;
620+ alter table registrations_new rename to registrations;
621+ `)
622+ return err
623+ })
624+625 // recreate and add rkey + created columns with default constraint
626 runMigration(db, "rework-collaborators-table", func(tx *sql.Tx) error {
627 // create new table