github.com/Ali-iotechsys/sqlboiler/v4@v4.0.0-20221208124957-6aec9a5f1f71/drivers/sqlboiler-mssql/driver/testdatabase.sql (about)

     1  SET QUOTED_IDENTIFIER ON;
     2  
     3  -- Don't forget to maintain order here, foreign keys!
     4  drop table if exists video_tags;
     5  drop table if exists tags;
     6  drop table if exists videos;
     7  drop table if exists sponsors;
     8  drop table if exists users;
     9  drop table if exists type_monsters;
    10  drop view if exists user_videos;
    11  
    12  -- Note that if we don't explicitly name foreign keys then MS SQL will
    13  -- generate a name that includes a random set of 8 hex digits at the end,
    14  -- meaning that the driver result varies every time it's run.
    15  
    16  create table users (
    17  	id int identity (1,1) primary key not null
    18  );
    19  
    20  create table sponsors (
    21  	id int identity (1,1) primary key not null
    22  );
    23  
    24  create table videos (
    25  	id int identity (1,1) primary key not null,
    26  	
    27  	user_id int not null,
    28  	sponsor_id int unique,
    29  
    30  	constraint FK_videos_users foreign key (user_id) references users (id),
    31  	constraint FK_videos_sponsors foreign key (sponsor_id) references sponsors (id)
    32  );
    33  
    34  create table tags (
    35  	id int identity (1,1) primary key not null
    36  );
    37  
    38  create table video_tags (
    39  	video_id int not null,
    40  	tag_id int not null,
    41  
    42  	primary key (video_id, tag_id),
    43  	constraint FK_video_tags_videos foreign key (video_id) references videos (id),
    44  	constraint FK_video_tags_tags foreign key (tag_id) references tags (id)
    45  );
    46  
    47  create table type_monsters (
    48  	id int identity (1,1) primary key not null,
    49  
    50  	id_two int not null,
    51  	id_three int,
    52  	bit_zero bit,
    53  	bit_one bit null,
    54  	bit_two bit not null,
    55  	bit_three bit null default 0,
    56  	bit_four bit null default 1,
    57  	bit_five bit not null default 0,
    58  	bit_six bit not null default 1,
    59  	string_zero varchar(1),
    60  	string_one varchar(1) null,
    61  	string_two varchar(1) not null,
    62  	string_three varchar(1) null default 'a',
    63  	string_four varchar(1) not null default 'b',
    64  	string_five varchar(1000),
    65  	string_six varchar(1000) null,
    66  	string_seven varchar(1000) not null,
    67  	string_eight varchar(1000) null default 'abcdefgh',
    68  	string_nine varchar(1000) not null default 'abcdefgh',
    69  	string_ten varchar(1000) null default '',
    70  	string_eleven varchar(1000) not null default '',
    71  	big_int_zero bigint,
    72  	big_int_one bigint null,
    73  	big_int_two bigint not null,
    74  	big_int_three bigint null default 111111,
    75  	big_int_four bigint not null default 222222,
    76  	big_int_five bigint null default 0,
    77  	big_int_six bigint not null default 0,
    78  	int_zero int,
    79  	int_one int null,
    80  	int_two int not null,
    81  	int_three int null default 333333,
    82  	int_four int not null default 444444,
    83  	int_five int null default 0,
    84  	int_six int not null default 0,
    85  	float_zero float,
    86  	float_one float,
    87  	float_two float(24),
    88  	float_three float(24),
    89  	float_four float(24) null,
    90  	float_five float(24) not null,
    91  	float_six float(24) null default 1.1,
    92  	float_seven float(24) not null default 1.1,
    93  	float_eight float(24) null default 0.0,
    94  	float_nine float(24) null default 0.0,
    95  	bytea_zero binary not null,
    96  	bytea_one binary not null,
    97  	bytea_two binary not null,
    98  	bytea_three binary not null default convert(varbinary(max),'a'),
    99  	bytea_four binary not null default convert(varbinary(max),'b'),
   100  	bytea_five binary(100) not null default convert(varbinary(max),'abcdefghabcdefghabcdefgh'),
   101  	bytea_six binary(100) not null default  convert(varbinary(max),'hgfedcbahgfedcbahgfedcba'),
   102  	bytea_seven binary not null default convert(varbinary(max),''),
   103  	bytea_eight binary not null default convert(varbinary(max),''),
   104  	time_zero timestamp not null,
   105  	time_one date,
   106  	time_eleven date null,
   107  	time_twelve date not null,
   108  	time_fifteen date null default '19990108',
   109  	time_sixteen date not null default '1999-01-08',
   110  
   111  	bit_null  bit null,
   112  	bit_nnull bit not null,
   113  
   114  	tinyint_null   tinyint null,
   115  	tinyint_nnull  tinyint not null,
   116  	smallint_null  smallint null,
   117  	smallint_nnull smallint not null,
   118  	int_null       int null,
   119  	int_nnull      int not null,
   120  	bigint_null    bigint null,
   121  	bigint_nnull   bigint not null,
   122  
   123  	float_null       float null,
   124  	float_nnull      float not null,
   125  	doubleprec_null  double precision null,
   126  	doubleprec_nnull double precision not null,
   127  	real_null        real null,
   128  	real_nnull       real not null,
   129  
   130  	date_null       date null,
   131  	date_nnull      date not null,
   132  	datetime_null   datetime null,
   133  	datetime_nnull  datetime not null,
   134  
   135  	binary_null  binary null,
   136  	binary_nnull binary not null,
   137  
   138  	varbinary_null     varbinary null,
   139  	varbinary_nnull    varbinary not null,
   140  	varbinary100_null  varbinary(100) null,
   141  	varbinary100_nnull varbinary(100) not null,
   142  	varbinarymax_null  varbinary(max) null,
   143  	varbinarymax_nnull varbinary(max) not null,
   144  
   145  	char_null        char null,
   146  	char_nnull       char not null,
   147  	varchar_null     varchar(max) null,
   148  	varchar_nnull    varchar(max) not null,
   149  	varchar100_null  varchar(100) null,
   150  	varchar100_nnull varchar(100) not null,
   151  
   152  	uniqueidentifier_null uniqueidentifier null,
   153  	uniqueidentifier_nnull uniqueidentifier not null,
   154  	datetimeoffset_null datetimeoffset null,
   155  	datetimeoffset_nnull datetimeoffset not null,
   156  
   157      generated_persisted AS bigint_nnull * bigint_null PERSISTED,
   158      generated_virtual AS smallint_nnull * smallint_null
   159  );
   160  
   161  GO
   162  
   163  create view user_videos as 
   164  select u.id user_id, v.id video_id, v.sponsor_id sponsor_id
   165  from users u
   166  inner join videos v on v.user_id = u.id;