-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdialect_mssql.go
More file actions
27 lines (25 loc) · 761 Bytes
/
dialect_mssql.go
File metadata and controls
27 lines (25 loc) · 761 Bytes
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
// SPDX-FileCopyrightText: 2026 The DMorph contributors.
// SPDX-License-Identifier: MPL-2.0
package dmorph
// DialectMSSQL returns a Dialect configured for Microsoft SQL Server databases.
func DialectMSSQL() BaseDialect {
return BaseDialect{
CreateTemplate: `
IF NOT EXISTS (
SELECT *
FROM sysobjects
WHERE name = '%s' AND xtype = 'U'
)
CREATE TABLE [%s] (
id NVARCHAR(255) PRIMARY KEY,
create_ts DATETIME DEFAULT GETDATE()
)`,
AppliedTemplate: `
SELECT id
FROM [%s]
ORDER BY create_ts ASC`,
RegisterTemplate: `
INSERT INTO [%s] (id)
VALUES (@id)`,
}
}