mirror of
https://github.com/signalapp/Signal-iOS.git
synced 2025-12-05 01:10:41 +00:00
Schema for pinned messages
This commit is contained in:
15
Signal/Symbols.xcassets/pin/pin-slash.imageset/Contents.json
vendored
Normal file
15
Signal/Symbols.xcassets/pin/pin-slash.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "pin-slash.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"template-rendering-intent" : "template"
|
||||
}
|
||||
}
|
||||
BIN
Signal/Symbols.xcassets/pin/pin-slash.imageset/pin-slash.pdf
vendored
Normal file
BIN
Signal/Symbols.xcassets/pin/pin-slash.imageset/pin-slash.pdf
vendored
Normal file
Binary file not shown.
15
Signal/Symbols.xcassets/pin/pin.imageset/Contents.json
vendored
Normal file
15
Signal/Symbols.xcassets/pin/pin.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "pin.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"template-rendering-intent" : "template"
|
||||
}
|
||||
}
|
||||
BIN
Signal/Symbols.xcassets/pin/pin.imageset/pin.pdf
vendored
Normal file
BIN
Signal/Symbols.xcassets/pin/pin.imageset/pin.pdf
vendored
Normal file
Binary file not shown.
@@ -84,6 +84,11 @@ public enum BuildFlags {
|
||||
public static let serviceIdBinaryOneOf = !serviceIdStrings
|
||||
|
||||
public static let serviceIdStrings = TSConstants.isUsingProductionService
|
||||
|
||||
public enum PinnedMessages {
|
||||
public static let send = build <= .dev
|
||||
public static let receive = build <= .dev
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: -
|
||||
|
||||
@@ -2568,3 +2568,37 @@ CREATE
|
||||
ON "UsernameLookupRecord"("username" COLLATE NOCASE
|
||||
)
|
||||
;
|
||||
|
||||
CREATE
|
||||
TABLE
|
||||
IF NOT EXISTS "PinnedMessage" (
|
||||
"id" INTEGER PRIMARY KEY NOT NULL
|
||||
,"interactionId" INTEGER NOT NULL UNIQUE REFERENCES "model_TSInteraction"("id"
|
||||
)
|
||||
ON DELETE
|
||||
CASCADE
|
||||
ON UPDATE
|
||||
CASCADE
|
||||
,"threadId" INTEGER NOT NULL REFERENCES "model_TSThread"("id"
|
||||
)
|
||||
ON DELETE
|
||||
CASCADE
|
||||
ON UPDATE
|
||||
CASCADE
|
||||
,"expiresAt" INTEGER
|
||||
)
|
||||
;
|
||||
|
||||
CREATE
|
||||
INDEX "index_PinnedMessage_on_threadId"
|
||||
ON "PinnedMessage"("threadId"
|
||||
)
|
||||
;
|
||||
|
||||
CREATE
|
||||
INDEX "partial_index_PinnedMessage_on_expiresAt"
|
||||
ON "PinnedMessage"("expiresAt"
|
||||
)
|
||||
WHERE
|
||||
"expiresAt" IS NOT NULL
|
||||
;
|
||||
|
||||
@@ -309,7 +309,8 @@ public extension DatabaseRecovery {
|
||||
"BackupOversizeTextCache",
|
||||
"Poll",
|
||||
"PollOption",
|
||||
"PollVote"
|
||||
"PollVote",
|
||||
"PinnedMessage"
|
||||
]
|
||||
|
||||
private static func prepareToCopyTablesWithBestEffort(
|
||||
|
||||
@@ -335,6 +335,7 @@ public class GRDBSchemaMigrator {
|
||||
case uniquifyUsernameLookupRecord2
|
||||
case fixRevokedForRestoredCallLinks
|
||||
case fixNameForRestoredCallLinks
|
||||
case addPinnedMessagesTable
|
||||
|
||||
// NOTE: Every time we add a migration id, consider
|
||||
// incrementing grdbSchemaVersionLatest.
|
||||
@@ -450,7 +451,7 @@ public class GRDBSchemaMigrator {
|
||||
}
|
||||
|
||||
public static let grdbSchemaVersionDefault: UInt = 0
|
||||
public static let grdbSchemaVersionLatest: UInt = 134
|
||||
public static let grdbSchemaVersionLatest: UInt = 135
|
||||
|
||||
// An optimization for new users, we have the first migration import the latest schema
|
||||
// and mark any other migrations as "already run".
|
||||
@@ -4275,6 +4276,47 @@ public class GRDBSchemaMigrator {
|
||||
return .success(())
|
||||
}
|
||||
|
||||
migrator.registerMigration(.addPinnedMessagesTable) { tx in
|
||||
try tx.database.create(
|
||||
table: "PinnedMessage"
|
||||
) { table in
|
||||
table.column("id", .integer).primaryKey().notNull()
|
||||
table.column("interactionId", .integer)
|
||||
.notNull()
|
||||
.unique()
|
||||
.references(
|
||||
"model_TSInteraction",
|
||||
column: "id",
|
||||
onDelete: .cascade,
|
||||
onUpdate: .cascade
|
||||
)
|
||||
table.column("threadId", .integer)
|
||||
.notNull()
|
||||
.references(
|
||||
"model_TSThread",
|
||||
column: "id",
|
||||
onDelete: .cascade,
|
||||
onUpdate: .cascade
|
||||
)
|
||||
table.column("expiresAt", .integer)
|
||||
}
|
||||
|
||||
try tx.database.create(
|
||||
index: "index_PinnedMessage_on_threadId",
|
||||
on: "PinnedMessage",
|
||||
columns: ["threadId"]
|
||||
)
|
||||
|
||||
try tx.database.create(
|
||||
index: "partial_index_PinnedMessage_on_expiresAt",
|
||||
on: "PinnedMessage",
|
||||
columns: ["expiresAt"],
|
||||
condition: Column("expiresAt") != nil
|
||||
)
|
||||
|
||||
return .success(())
|
||||
}
|
||||
|
||||
// MARK: - Schema Migration Insertion Point
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user