You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-ios/SessionMessagingKit/Database/Migrations/_001_InitialSetupMigration....

44 lines
1.3 KiB
Swift

// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
import Foundation
import GRDB
import SessionUtilitiesKit
enum _001_InitialSetupMigration: Migration {
static let identifier: String = "initialSetup"
static func migrate(_ db: Database) throws {
try db.create(table: Contact.self) { t in
t.column(.id, .text)
.notNull()
.primaryKey()
t.column(.isTrusted, .boolean)
.notNull()
.defaults(to: false)
t.column(.isApproved, .boolean)
.notNull()
.defaults(to: false)
t.column(.isBlocked, .boolean)
.notNull()
.defaults(to: false)
t.column(.didApproveMe, .boolean)
.notNull()
.defaults(to: false)
t.column(.hasBeenBlocked, .boolean)
.notNull()
.defaults(to: false)
}
try db.create(table: Profile.self) { t in
t.column(.id, .text)
.notNull()
.primaryKey()
t.column(.name, .text).notNull()
t.column(.nickname, .text)
t.column(.profilePictureUrl, .text)
t.column(.profilePictureFileName, .text)
t.column(.profileEncryptionKey, .blob)
}
}
}