Yii2 SQL Server schema for user table

by Dani Arlandis — on  , 

cover-image

Yii2 and SqlServer

When you can need apply the user administration in Yii2 you can use this schema for create the users table for basic authentication in Yii2.

USE [name for your database]
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [user](
[id] [int] IDENTITY(1,1) NOT NULL,
[username] [nvarchar](255) NOT NULL,
[auth_key] [nvarchar](32) NOT NULL,
[password_hash] [nvarchar](255) NOT NULL,
[password_reset_token] [nvarchar](255) NOT NULL,
[email] [nvarchar](100) NOT NULL,
     [status] [int] NOT NULL,
     [role] [int] NOT NULL,
     [created_at] [int] NOT NULL,
     [updated_at] [int] NOT NULL,
 CONSTRAINT [PK_user] PRIMARY KEY CLUSTERED
(
     [id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO