mirror of
https://github.com/bitwarden/server.git
synced 2025-04-05 05:00:19 -05:00

* Update Models - Add Controller Method * Add MSSQL Migration * Update SQL Proj * Update SQL Migration * Update Models * Update SQL Project * Add EF Migrations * Switch to using Identifier * Update Code Comment
26 lines
899 B
Transact-SQL
26 lines
899 B
Transact-SQL
CREATE TABLE [dbo].[Device] (
|
|
[Id] UNIQUEIDENTIFIER NOT NULL,
|
|
[UserId] UNIQUEIDENTIFIER NOT NULL,
|
|
[Name] NVARCHAR (50) NOT NULL,
|
|
[Type] SMALLINT NOT NULL,
|
|
[Identifier] NVARCHAR (50) NOT NULL,
|
|
[PushToken] NVARCHAR (255) NULL,
|
|
[CreationDate] DATETIME2 (7) NOT NULL,
|
|
[RevisionDate] DATETIME2 (7) NOT NULL,
|
|
[EncryptedUserKey] VARCHAR (MAX) NULL,
|
|
[EncryptedPublicKey] VARCHAR (MAX) NULL,
|
|
[EncryptedPrivateKey] VARCHAR (MAX) NULL,
|
|
CONSTRAINT [PK_Device] PRIMARY KEY CLUSTERED ([Id] ASC),
|
|
CONSTRAINT [FK_Device_User] FOREIGN KEY ([UserId]) REFERENCES [dbo].[User] ([Id])
|
|
);
|
|
|
|
|
|
GO
|
|
CREATE UNIQUE NONCLUSTERED INDEX [UX_Device_UserId_Identifier]
|
|
ON [dbo].[Device]([UserId] ASC, [Identifier] ASC);
|
|
|
|
|
|
GO
|
|
CREATE NONCLUSTERED INDEX [IX_Device_Identifier]
|
|
ON [dbo].[Device]([Identifier] ASC);
|