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

     1  -- Don't forget to maintain order here, foreign keys!
     2  drop table if exists video_tags;
     3  drop table if exists tags;
     4  drop table if exists videos;
     5  drop table if exists sponsors;
     6  drop table if exists users;
     7  drop table if exists type_monsters;
     8  drop view if exists user_videos;
     9  
    10  create table users (
    11  	id int primary key not null auto_increment
    12  );
    13  
    14  create table sponsors (
    15  	id int primary key not null auto_increment
    16  );
    17  
    18  create table videos (
    19  	id int primary key not null auto_increment,
    20  	
    21  	user_id int not null,
    22  	sponsor_id int unique,
    23  
    24  	foreign key (user_id) references users (id),
    25  	foreign key (sponsor_id) references sponsors (id)
    26  );
    27  
    28  create table tags (
    29  	id int primary key not null auto_increment
    30  );
    31  
    32  create table video_tags (
    33  	video_id int not null,
    34  	tag_id   int not null,
    35  
    36  	primary key (video_id, tag_id),
    37  	foreign key (video_id) references videos (id),
    38  	foreign key (tag_id) references tags (id)
    39  );
    40  
    41  create table type_monsters (
    42  	id int primary key not null auto_increment,
    43  
    44  	enum_use        enum('monday', 'tuesday', 'wednesday', 'thursday', 'friday') not null,
    45  	enum_nullable   enum('monday', 'tuesday', 'wednesday', 'thursday', 'friday'),
    46  
    47  	id_two     int not null,
    48  	id_three   int,
    49  	bool_zero  bool,
    50  	bool_one   bool null,
    51  	bool_two   bool not null,
    52  	bool_three bool null default false,
    53  	bool_four  bool null default true,
    54  	bool_five  bool not null default false,
    55  	bool_six   bool not null default true,
    56  
    57  	string_zero   varchar(1),
    58  	string_one    varchar(1) null,
    59  	string_two    varchar(1) not null,
    60  	string_three  varchar(1) null default 'a',
    61  	string_four   varchar(1) not null default 'b',
    62  	string_five   varchar(1000),
    63  	string_six    varchar(1000) null,
    64  	string_seven  varchar(1000) not null,
    65  	string_eight  varchar(1000) null default 'abcdefgh',
    66  	string_nine   varchar(1000) not null default 'abcdefgh',
    67  	string_ten    varchar(1000) null default '',
    68  	string_eleven varchar(1000) not null default '',
    69  
    70  	big_int_zero  bigint,
    71  	big_int_one   bigint NULL,
    72  	big_int_two   bigint NOT NULL,
    73  	big_int_three bigint NULL DEFAULT 111111,
    74  	big_int_four  bigint NOT NULL DEFAULT 222222,
    75  	big_int_five  bigint NULL DEFAULT 0,
    76  	big_int_six   bigint NOT NULL DEFAULT 0,
    77  
    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  
    86  	float_zero  float,
    87  	float_one   float,
    88  	float_two   float(2,1),
    89  	float_three float(2,1),
    90  	float_four  float(2,1) null,
    91  	float_five  float(2,1) not null,
    92  	float_six   float(2,1) null default 1.1,
    93  	float_seven float(2,1) not null default 1.1,
    94  	float_eight float(2,1) null default 0.0,
    95  	float_nine  float(2,1) null default 0.0,
    96  	bytea_zero  binary,
    97  	bytea_one   binary null,
    98  	bytea_two   binary not null,
    99  	bytea_three binary not null default 'a',
   100  	bytea_four  binary null default 'b',
   101  	bytea_five  binary(100) not null default 'abcdefghabcdefghabcdefgh',
   102  	bytea_six   binary(100) null default 'hgfedcbahgfedcbahgfedcba',
   103  	bytea_seven binary not null default '',
   104  	bytea_eight binary not null default '',
   105  	time_zero   timestamp,
   106  	time_one    date,
   107  	time_two    timestamp null default null,
   108  	time_three  timestamp null,
   109  	time_five   timestamp null default current_timestamp,
   110  	time_nine   timestamp not null default current_timestamp,
   111  	time_eleven date null,
   112  	time_twelve date not null,
   113  	time_fifteen date null default '19990108',
   114  	time_sixteen date not null default '1999-01-08',
   115  
   116  	json_null  json null,
   117  	json_nnull json not null,
   118  
   119  	tinyint_null    tinyint null,
   120  	tinyint_nnull   tinyint not null,
   121  	tinyint1_null   tinyint(1) null,
   122  	tinyint1_nnull  tinyint(1) not null,
   123  	tinyint2_null   tinyint(2) null,
   124  	tinyint2_nnull  tinyint(2) not null,
   125  	smallint_null   smallint null,
   126  	smallint_nnull  smallint not null,
   127  	mediumint_null  mediumint null,
   128  	mediumint_nnull mediumint not null,
   129  	bigint_null     bigint null,
   130  	bigint_nnull    bigint not null,
   131  
   132  	float_null       float null,
   133  	float_nnull      float not null,
   134  	double_null      double null,
   135  	double_nnull     double not null,
   136  	doubleprec_null  double precision null,
   137  	doubleprec_nnull double precision not null,
   138  
   139  	real_null  real null,
   140  	real_nnull real not null,
   141  
   142  	boolean_null  boolean null,
   143  	boolean_nnull boolean not null,
   144  
   145  	date_null  date null,
   146  	date_nnull date not null,
   147  
   148  	datetime_null  datetime null,
   149  	datetime_nnull datetime not null,
   150  
   151  	timestamp_null  timestamp null,
   152  	timestamp_nnull timestamp not null default current_timestamp,
   153  
   154  	binary_null      binary null,
   155  	binary_nnull     binary not null,
   156  	varbinary_null   varbinary(100) null,
   157  	varbinary_nnull  varbinary(100) not null,
   158  	tinyblob_null    tinyblob null,
   159  	tinyblob_nnull   tinyblob not null,
   160  	blob_null        blob null,
   161  	blob_nnull       blob not null,
   162  	mediumblob_null  mediumblob null,
   163  	mediumblob_nnull mediumblob not null,
   164  	longblob_null    longblob null,
   165  	longblob_nnull   longblob not null,
   166  
   167  	varchar_null  varchar(100) null,
   168  	varchar_nnull varchar(100) not null,
   169  	char_null     char null,
   170  	char_nnull    char not null,
   171  	text_null     text null,
   172  	text_nnull    text not null,
   173  
   174  
   175      virtual_nnull text GENERATED ALWAYS AS (UPPER(text_nnull)) VIRTUAL NOT NULL,
   176      virtual_null text GENERATED ALWAYS AS (UPPER(text_null)) VIRTUAL,
   177      generated_nnull text GENERATED ALWAYS AS (UPPER(text_nnull)) STORED NOT NULL,
   178      generated_null text GENERATED ALWAYS AS (UPPER(text_null)) STORED
   179  );
   180  
   181  create view user_videos as 
   182  select u.id user_id, v.id video_id, v.sponsor_id sponsor_id
   183  from users u
   184  inner join videos v on v.user_id = u.id;