AuthStore.migrations 929 B

1234567891011121314151617181920212223242526272829303132
  1. :VERSION 1
  2. BEGIN TRANSACTION
  3. CREATE TABLE [auth] (
  4. [uuid] [uniqueidentifier] NOT NULL default '00000000-0000-0000-0000-000000000000',
  5. [passwordHash] [varchar](32) NOT NULL,
  6. [passwordSalt] [varchar](32) NOT NULL,
  7. [webLoginKey] [varchar](255) NOT NULL,
  8. [accountType] VARCHAR(32) NOT NULL DEFAULT 'UserAccount',
  9. ) ON [PRIMARY]
  10. CREATE TABLE [tokens] (
  11. [uuid] [uniqueidentifier] NOT NULL default '00000000-0000-0000-0000-000000000000',
  12. [token] [varchar](255) NOT NULL,
  13. [validity] [datetime] NOT NULL )
  14. ON [PRIMARY]
  15. COMMIT
  16. :VERSION 2
  17. BEGIN TRANSACTION
  18. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[users]') AND type in (N'U'))
  19. INSERT INTO auth (UUID, passwordHash, passwordSalt, webLoginKey, accountType) SELECT [UUID] AS UUID, [passwordHash] AS passwordHash, [passwordSalt] AS passwordSalt, [webLoginKey] AS webLoginKey, 'UserAccount' as [accountType] FROM users;
  20. COMMIT