-
-
Notifications
You must be signed in to change notification settings - Fork 295
feat(structure): add Triggers tab to Show Structure for MySQL, PostgreSQL, and SQLite #1696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import Foundation | ||
|
|
||
| public struct PluginTriggerInfo: Codable, Sendable { | ||
| public let name: String | ||
| public let timing: String | ||
| public let event: String | ||
| public let forEachRow: Bool | ||
| public let whenClause: String? | ||
| public let statement: String | ||
|
|
||
| public init( | ||
| name: String, | ||
| timing: String, | ||
| event: String, | ||
| forEachRow: Bool = true, | ||
| whenClause: String? = nil, | ||
| statement: String | ||
| ) { | ||
| self.name = name | ||
| self.timing = timing | ||
| self.event = event | ||
| self.forEachRow = forEachRow | ||
| self.whenClause = whenClause | ||
| self.statement = statement | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,6 +54,7 @@ struct PluginMetadataSnapshot: Sendable { | |
| var supportsAddIndex: Bool = true | ||
| var supportsDropIndex: Bool = true | ||
| var supportsModifyPrimaryKey: Bool = true | ||
| var supportsTriggers: Bool = false | ||
| var defaultSSLMode: SSLMode = .disabled | ||
| var supportsOpportunisticTLS: Bool = true | ||
| var supportsCloudflareTunnel: Bool = true | ||
|
|
@@ -449,6 +450,7 @@ final class PluginMetadataRegistry: @unchecked Sendable { | |
| requiresReconnectForDatabaseSwitch: false, | ||
| supportsDropDatabase: true, | ||
| supportsRenameColumn: true, | ||
| supportsTriggers: true, | ||
| defaultSSLMode: .preferred | ||
| ), | ||
| schema: PluginMetadataSnapshot.SchemaInfo( | ||
|
|
@@ -498,6 +500,7 @@ final class PluginMetadataRegistry: @unchecked Sendable { | |
| requiresReconnectForDatabaseSwitch: false, | ||
| supportsDropDatabase: true, | ||
| supportsRenameColumn: true, | ||
| supportsTriggers: true, | ||
| defaultSSLMode: .preferred | ||
| ), | ||
| schema: PluginMetadataSnapshot.SchemaInfo( | ||
|
|
@@ -548,6 +551,7 @@ final class PluginMetadataRegistry: @unchecked Sendable { | |
| requiresReconnectForDatabaseSwitch: true, | ||
| supportsDropDatabase: true, | ||
| supportsRenameColumn: true, | ||
| supportsTriggers: true, | ||
| defaultSSLMode: .preferred | ||
| ), | ||
| schema: PluginMetadataSnapshot.SchemaInfo( | ||
|
|
@@ -709,6 +713,7 @@ final class PluginMetadataRegistry: @unchecked Sendable { | |
| supportsModifyColumn: false, | ||
| supportsRenameColumn: true, | ||
| supportsModifyPrimaryKey: false, | ||
| supportsTriggers: true, | ||
| supportsCloudflareTunnel: false | ||
| ), | ||
| schema: PluginMetadataSnapshot.SchemaInfo( | ||
|
|
@@ -894,6 +899,7 @@ final class PluginMetadataRegistry: @unchecked Sendable { | |
| supportsAddIndex: driverType.supportsAddIndex, | ||
| supportsDropIndex: driverType.supportsDropIndex, | ||
| supportsModifyPrimaryKey: driverType.supportsModifyPrimaryKey, | ||
| supportsTriggers: driverType.supportsTriggers, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For third-party drivers compiled against the previous PluginKit, this new Useful? React with 👍 / 👎. |
||
| defaultSSLMode: existingSnapshot?.capabilities.defaultSSLMode ?? .disabled, | ||
| supportsOpportunisticTLS: existingSnapshot?.capabilities.supportsOpportunisticTLS ?? true, | ||
| supportsCloudflareTunnel: driverType.supportsSSH, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -196,6 +196,10 @@ extension DatabaseType { | |
| PluginMetadataRegistry.shared.snapshot(forTypeId: pluginTypeId)?.supportsForeignKeys ?? true | ||
| } | ||
|
|
||
| var supportsTriggers: Bool { | ||
| PluginMetadataRegistry.shared.snapshot(forTypeId: pluginTypeId)?.capabilities.supportsTriggers ?? false | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the connection type is an alias such as Redshift or CockroachDB, Useful? React with 👍 / 👎. |
||
| } | ||
|
|
||
| var supportsSchemaEditing: Bool { | ||
| PluginMetadataRegistry.shared.snapshot(forTypeId: rawValue)?.supportsSchemaEditing ?? true | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PostgreSQL's
tgtypeuses bit 8 for DELETE and bit 16 for UPDATE, but these branches label them the other way around. Any single-event UPDATE trigger will be shown as DELETE, and DELETE triggers as UPDATE, with the same mix-up in the multi-event labels above.Useful? React with 👍 / 👎.