-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalter_database_set_statement.go
More file actions
281 lines (224 loc) · 10.4 KB
/
alter_database_set_statement.go
File metadata and controls
281 lines (224 loc) · 10.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
package ast
// AlterDatabaseSetStatement represents ALTER DATABASE ... SET statement
type AlterDatabaseSetStatement struct {
DatabaseName *Identifier
UseCurrent bool
WithManualCutover bool
Options []DatabaseOption
}
func (a *AlterDatabaseSetStatement) node() {}
func (a *AlterDatabaseSetStatement) statement() {}
// DatabaseOption is an interface for database options
type DatabaseOption interface {
Node
databaseOption()
}
// AcceleratedDatabaseRecoveryDatabaseOption represents ACCELERATED_DATABASE_RECOVERY option
type AcceleratedDatabaseRecoveryDatabaseOption struct {
OptionKind string // "AcceleratedDatabaseRecovery"
OptionState string // "On" or "Off"
}
func (a *AcceleratedDatabaseRecoveryDatabaseOption) node() {}
func (a *AcceleratedDatabaseRecoveryDatabaseOption) databaseOption() {}
// OnOffDatabaseOption represents a simple ON/OFF database option
type OnOffDatabaseOption struct {
OptionKind string // "TemporalHistoryRetention", etc.
OptionState string // "On" or "Off"
}
func (o *OnOffDatabaseOption) node() {}
func (o *OnOffDatabaseOption) databaseOption() {}
// DelayedDurabilityDatabaseOption represents DELAYED_DURABILITY option
type DelayedDurabilityDatabaseOption struct {
OptionKind string // "DelayedDurability"
Value string // "Disabled", "Allowed", "Forced"
}
func (d *DelayedDurabilityDatabaseOption) node() {}
func (d *DelayedDurabilityDatabaseOption) databaseOption() {}
// AutoCreateStatisticsDatabaseOption represents AUTO_CREATE_STATISTICS option with optional INCREMENTAL
type AutoCreateStatisticsDatabaseOption struct {
OptionKind string // "AutoCreateStatistics"
OptionState string // "On" or "Off"
HasIncremental bool // Whether INCREMENTAL is specified
IncrementalState string // "On" or "Off"
}
func (a *AutoCreateStatisticsDatabaseOption) node() {}
func (a *AutoCreateStatisticsDatabaseOption) databaseOption() {}
// IdentifierDatabaseOption represents a database option with an identifier value
type IdentifierDatabaseOption struct {
OptionKind string `json:"OptionKind,omitempty"` // "CatalogCollation"
Value *Identifier `json:"Value,omitempty"`
}
func (i *IdentifierDatabaseOption) node() {}
func (i *IdentifierDatabaseOption) databaseOption() {}
// CreateDatabaseOption is an interface for CREATE DATABASE options (can be DatabaseOption)
type CreateDatabaseOption interface {
node()
createDatabaseOption()
}
// Make existing database options implement CreateDatabaseOption
func (o *OnOffDatabaseOption) createDatabaseOption() {}
func (i *IdentifierDatabaseOption) createDatabaseOption() {}
func (d *DelayedDurabilityDatabaseOption) createDatabaseOption() {}
// SimpleDatabaseOption represents a simple database option with just OptionKind (e.g., ENABLE_BROKER)
type SimpleDatabaseOption struct {
OptionKind string `json:"OptionKind,omitempty"`
}
func (d *SimpleDatabaseOption) node() {}
func (d *SimpleDatabaseOption) createDatabaseOption() {}
// MaxSizeDatabaseOption represents a MAXSIZE option.
type MaxSizeDatabaseOption struct {
OptionKind string `json:"OptionKind,omitempty"`
MaxSize ScalarExpression `json:"MaxSize,omitempty"`
Units string `json:"Units,omitempty"` // "GB", "TB", etc.
}
func (m *MaxSizeDatabaseOption) node() {}
func (m *MaxSizeDatabaseOption) databaseOption() {}
func (m *MaxSizeDatabaseOption) createDatabaseOption() {}
// LiteralDatabaseOption represents a database option with a literal value (e.g., EDITION).
type LiteralDatabaseOption struct {
OptionKind string `json:"OptionKind,omitempty"`
Value ScalarExpression `json:"Value,omitempty"`
}
func (l *LiteralDatabaseOption) node() {}
func (l *LiteralDatabaseOption) databaseOption() {}
func (l *LiteralDatabaseOption) createDatabaseOption() {}
// AlterDatabaseAddFileStatement represents ALTER DATABASE ... ADD FILE statement
type AlterDatabaseAddFileStatement struct {
DatabaseName *Identifier
FileDeclarations []*FileDeclaration
FileGroup *Identifier
IsLog bool
UseCurrent bool
}
func (a *AlterDatabaseAddFileStatement) node() {}
func (a *AlterDatabaseAddFileStatement) statement() {}
// AlterDatabaseAddFileGroupStatement represents ALTER DATABASE ... ADD FILEGROUP statement
type AlterDatabaseAddFileGroupStatement struct {
DatabaseName *Identifier
FileGroupName *Identifier
ContainsFileStream bool
ContainsMemoryOptimizedData bool
UseCurrent bool
}
func (a *AlterDatabaseAddFileGroupStatement) node() {}
func (a *AlterDatabaseAddFileGroupStatement) statement() {}
// AlterDatabaseModifyFileStatement represents ALTER DATABASE ... MODIFY FILE statement
type AlterDatabaseModifyFileStatement struct {
DatabaseName *Identifier
FileDeclaration *FileDeclaration
UseCurrent bool
}
func (a *AlterDatabaseModifyFileStatement) node() {}
func (a *AlterDatabaseModifyFileStatement) statement() {}
// AlterDatabaseModifyFileGroupStatement represents ALTER DATABASE ... MODIFY FILEGROUP statement
type AlterDatabaseModifyFileGroupStatement struct {
DatabaseName *Identifier
FileGroupName *Identifier
MakeDefault bool
UpdatabilityOption string // "ReadOnly", "ReadWrite", "ReadOnlyOld", "ReadWriteOld", or ""
NewFileGroupName *Identifier
}
func (a *AlterDatabaseModifyFileGroupStatement) node() {}
func (a *AlterDatabaseModifyFileGroupStatement) statement() {}
// AlterDatabaseModifyNameStatement represents ALTER DATABASE ... MODIFY NAME statement
type AlterDatabaseModifyNameStatement struct {
DatabaseName *Identifier
NewName *Identifier
}
func (a *AlterDatabaseModifyNameStatement) node() {}
func (a *AlterDatabaseModifyNameStatement) statement() {}
// AlterDatabaseRemoveFileStatement represents ALTER DATABASE ... REMOVE FILE statement
type AlterDatabaseRemoveFileStatement struct {
DatabaseName *Identifier
FileName *Identifier
}
func (a *AlterDatabaseRemoveFileStatement) node() {}
func (a *AlterDatabaseRemoveFileStatement) statement() {}
// AlterDatabaseRemoveFileGroupStatement represents ALTER DATABASE ... REMOVE FILEGROUP statement
type AlterDatabaseRemoveFileGroupStatement struct {
DatabaseName *Identifier
FileGroupName *Identifier
UseCurrent bool
}
func (a *AlterDatabaseRemoveFileGroupStatement) node() {}
func (a *AlterDatabaseRemoveFileGroupStatement) statement() {}
// AlterDatabaseCollateStatement represents ALTER DATABASE ... COLLATE statement
type AlterDatabaseCollateStatement struct {
DatabaseName *Identifier
Collation *Identifier
}
func (a *AlterDatabaseCollateStatement) node() {}
func (a *AlterDatabaseCollateStatement) statement() {}
// AlterDatabaseScopedConfigurationClearStatement represents ALTER DATABASE SCOPED CONFIGURATION CLEAR statement
type AlterDatabaseScopedConfigurationClearStatement struct {
Option *DatabaseConfigurationClearOption
Secondary bool
}
func (a *AlterDatabaseScopedConfigurationClearStatement) node() {}
func (a *AlterDatabaseScopedConfigurationClearStatement) statement() {}
// DatabaseConfigurationClearOption represents a CLEAR option
type DatabaseConfigurationClearOption struct {
OptionKind string // "ProcedureCache"
PlanHandle ScalarExpression // Optional binary plan handle
}
func (d *DatabaseConfigurationClearOption) node() {}
// RemoteDataArchiveDatabaseOption represents REMOTE_DATA_ARCHIVE database option
type RemoteDataArchiveDatabaseOption struct {
OptionKind string // "RemoteDataArchive"
OptionState string // "On", "Off", "NotSet"
Settings []RemoteDataArchiveDbSetting // Settings like SERVER, CREDENTIAL, FEDERATED_SERVICE_ACCOUNT
}
func (r *RemoteDataArchiveDatabaseOption) node() {}
func (r *RemoteDataArchiveDatabaseOption) databaseOption() {}
// RemoteDataArchiveDbSetting is an interface for Remote Data Archive settings
type RemoteDataArchiveDbSetting interface {
Node
remoteDataArchiveDbSetting()
}
// RemoteDataArchiveDbServerSetting represents the SERVER setting
type RemoteDataArchiveDbServerSetting struct {
SettingKind string // "Server"
Server ScalarExpression // The server string literal
}
func (r *RemoteDataArchiveDbServerSetting) node() {}
func (r *RemoteDataArchiveDbServerSetting) remoteDataArchiveDbSetting() {}
// RemoteDataArchiveDbCredentialSetting represents the CREDENTIAL setting
type RemoteDataArchiveDbCredentialSetting struct {
SettingKind string // "Credential"
Credential *Identifier // The credential name
}
func (r *RemoteDataArchiveDbCredentialSetting) node() {}
func (r *RemoteDataArchiveDbCredentialSetting) remoteDataArchiveDbSetting() {}
// RemoteDataArchiveDbFederatedServiceAccountSetting represents the FEDERATED_SERVICE_ACCOUNT setting
type RemoteDataArchiveDbFederatedServiceAccountSetting struct {
SettingKind string // "FederatedServiceAccount"
IsOn bool // true for ON, false for OFF
}
func (r *RemoteDataArchiveDbFederatedServiceAccountSetting) node() {}
func (r *RemoteDataArchiveDbFederatedServiceAccountSetting) remoteDataArchiveDbSetting() {}
// ChangeTrackingDatabaseOption represents the CHANGE_TRACKING database option
type ChangeTrackingDatabaseOption struct {
OptionKind string // "ChangeTracking"
OptionState string // "On", "Off", "NotSet"
Details []ChangeTrackingOptionDetail // AUTO_CLEANUP, CHANGE_RETENTION
}
func (c *ChangeTrackingDatabaseOption) node() {}
func (c *ChangeTrackingDatabaseOption) databaseOption() {}
// ChangeTrackingOptionDetail is an interface for change tracking option details
type ChangeTrackingOptionDetail interface {
Node
changeTrackingOptionDetail()
}
// AutoCleanupChangeTrackingOptionDetail represents AUTO_CLEANUP option
type AutoCleanupChangeTrackingOptionDetail struct {
IsOn bool
}
func (a *AutoCleanupChangeTrackingOptionDetail) node() {}
func (a *AutoCleanupChangeTrackingOptionDetail) changeTrackingOptionDetail() {}
// ChangeRetentionChangeTrackingOptionDetail represents CHANGE_RETENTION option
type ChangeRetentionChangeTrackingOptionDetail struct {
RetentionPeriod ScalarExpression
Unit string // "Days", "Hours", "Minutes"
}
func (c *ChangeRetentionChangeTrackingOptionDetail) node() {}
func (c *ChangeRetentionChangeTrackingOptionDetail) changeTrackingOptionDetail() {}