Skip to content

Commit 928963a

Browse files
committed
Remove email verified flag
1 parent 7a10b45 commit 928963a

File tree

3 files changed

+8
-16
lines changed

3 files changed

+8
-16
lines changed

migrate.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func migrateUsers(pgDB *sql.DB, tx *sql.Tx, stats *MigrationStats) error {
129129

130130
func migrateAccounts(pgDB *sql.DB, tx *sql.Tx, stats *MigrationStats) error {
131131
rows, err := pgDB.Query(`
132-
SELECT id, created_at, updated_at, user_id, email, email_verified, password
132+
SELECT id, created_at, updated_at, user_id, email, password
133133
FROM accounts
134134
ORDER BY id
135135
`)
@@ -139,8 +139,8 @@ func migrateAccounts(pgDB *sql.DB, tx *sql.Tx, stats *MigrationStats) error {
139139
defer rows.Close()
140140

141141
stmt, err := tx.Prepare(`
142-
INSERT INTO accounts (id, created_at, updated_at, user_id, email, email_verified, password)
143-
VALUES (?, ?, ?, ?, ?, ?, ?)
142+
INSERT INTO accounts (id, created_at, updated_at, user_id, email, password)
143+
VALUES (?, ?, ?, ?, ?, ?)
144144
`)
145145
if err != nil {
146146
return err
@@ -151,13 +151,12 @@ func migrateAccounts(pgDB *sql.DB, tx *sql.Tx, stats *MigrationStats) error {
151151
var id, userID int
152152
var createdAt, updatedAt time.Time
153153
var email, password sql.NullString
154-
var emailVerified bool
155154

156-
if err := rows.Scan(&id, &createdAt, &updatedAt, &userID, &email, &emailVerified, &password); err != nil {
155+
if err := rows.Scan(&id, &createdAt, &updatedAt, &userID, &email, &password); err != nil {
157156
return err
158157
}
159158

160-
if _, err := stmt.Exec(id, createdAt, updatedAt, userID, email, emailVerified, password); err != nil {
159+
if _, err := stmt.Exec(id, createdAt, updatedAt, userID, email, password); err != nil {
161160
return err
162161
}
163162
stats.Accounts++

migrate_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,6 @@ func TestMigration(t *testing.T) {
266266
if sqliteAccount1.Email.String != account1.Email.String {
267267
t.Errorf("Account1 Email: expected %s, got %s", account1.Email.String, sqliteAccount1.Email.String)
268268
}
269-
if sqliteAccount1.EmailVerified != account1.EmailVerified {
270-
t.Errorf("Account1 EmailVerified: expected %v, got %v", account1.EmailVerified, sqliteAccount1.EmailVerified)
271-
}
272269
if sqliteAccount1.Password.String != account1.Password.String {
273270
t.Errorf("Account1 Password: expected %s, got %s", account1.Password.String, sqliteAccount1.Password.String)
274271
}
@@ -287,9 +284,6 @@ func TestMigration(t *testing.T) {
287284
if sqliteAccount2.Email.String != account2.Email.String {
288285
t.Errorf("Account2 Email: expected %s, got %s", account2.Email.String, sqliteAccount2.Email.String)
289286
}
290-
if sqliteAccount2.EmailVerified != account2.EmailVerified {
291-
t.Errorf("Account2 EmailVerified: expected %v, got %v", account2.EmailVerified, sqliteAccount2.EmailVerified)
292-
}
293287

294288
// Verify book1
295289
var sqliteBook1 SqliteBook

sqlite_models.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,9 @@ func (SqliteUser) TableName() string {
6262

6363
type SqliteAccount struct {
6464
SqliteModel
65-
UserID int `gorm:"index"`
66-
Email NullString
67-
EmailVerified bool `gorm:"default:false"`
68-
Password NullString
65+
UserID int `gorm:"index"`
66+
Email NullString
67+
Password NullString
6968
}
7069

7170
func (SqliteAccount) TableName() string {

0 commit comments

Comments
 (0)