github.com/ecodeclub/eorm@v0.0.2-0.20231001112437-dae71da914d0/script/mysql/init.sql (about)

     1  create database if not exists `integration_test`;
     2  create table if not exists `integration_test`.`simple_struct`
     3  (
     4      `id` bigint auto_increment,
     5      bool smallint not null,
     6      bool_ptr smallint,
     7      `int` int not null,
     8      int_ptr int,
     9      `int8` smallint not null,
    10      int8_ptr smallint,
    11      int16 int not null,
    12      int16_ptr int,
    13      int32 int not null,
    14      int32_ptr int,
    15      int64 bigint not null,
    16      int64_ptr bigint,
    17      uint int not null,
    18      uint_ptr int,
    19      uint8 int not null,
    20      uint8_ptr int,
    21      uint16 int not null,
    22      uint16_ptr int,
    23      uint32 int not null,
    24      uint32_ptr int,
    25      uint64 bigint not null,
    26      uint64_ptr bigint,
    27      float32 float not null,
    28      float32_ptr float,
    29      float64 float not null,
    30      float64_ptr float,
    31      byte_array varchar(1024),
    32      string varchar(1024) not null,
    33      null_string_ptr varchar(1024),
    34      null_int16_ptr int,
    35      null_int32_ptr int,
    36      null_int64_ptr int,
    37      null_bool_ptr smallint,
    38      null_time_ptr datetime,
    39      null_float64_ptr float,
    40      json_column varchar(2048),
    41      primary key (`id`)
    42      );
    43  
    44  create table if not exists `integration_test`.`combined_model`
    45  (
    46      `id`          bigint auto_increment
    47      primary key,
    48      `first_name`  varchar(128) null,
    49      `age`         int          null,
    50      `last_name`   varchar(128) null,
    51      `create_time` bigint       null,
    52      `update_time` bigint       null
    53      );
    54  create table if not exists `integration_test`.`order`
    55  (
    56      `id`          bigint auto_increment
    57          primary key,
    58      `using_col1`  varchar(128) null,
    59      `using_col2`  varchar(128) null
    60      );
    61  create table if not exists `integration_test`.`order_detail`
    62  (
    63      `order_id`          bigint auto_increment
    64          primary key,
    65      `item_id`  bigint null,
    66      `using_col1`  varchar(128) null,
    67      `using_col2`  varchar(128) null
    68      );
    69  
    70  create table if not exists `integration_test`.`item`
    71  (
    72      `id`          bigint auto_increment
    73          primary key
    74      );
    75  
    76          /* sharding test */
    77          create database if not exists `order_detail_db_0`;
    78          create database if not exists `order_detail_db_1`;
    79  
    80  create table if not exists `order_detail_db_0`.`order_detail_tab_0`
    81  (
    82      `order_id`          int(11) auto_increment
    83      primary key,
    84      `item_id`  int(11),
    85      `using_col1`  varchar(128) null,
    86      `using_col2`  varchar(128) null
    87      );
    88  
    89  create table if not exists `order_detail_db_0`.`order_detail_tab_1`
    90  (
    91      `order_id`          int(11) auto_increment
    92      primary key,
    93      `item_id`  int(11),
    94      `using_col1`  varchar(128) null,
    95      `using_col2`  varchar(128) null
    96      );
    97  
    98  create table if not exists `order_detail_db_0`.`order_detail_tab_2`
    99  (
   100      `order_id`          int(11) auto_increment
   101      primary key,
   102      `item_id`  int(11),
   103      `using_col1`  varchar(128) null,
   104      `using_col2`  varchar(128) null
   105      );
   106  
   107  create table if not exists `order_detail_db_1`.`order_detail_tab_0`
   108  (
   109      `order_id`          int(11) auto_increment
   110      primary key,
   111      `item_id`  int(11),
   112      `using_col1`  varchar(128) null,
   113      `using_col2`  varchar(128) null
   114      );
   115  
   116  create table if not exists `order_detail_db_1`.`order_detail_tab_1`
   117  (
   118      `order_id`          int(11) auto_increment
   119      primary key,
   120      `item_id`  int(11),
   121      `using_col1`  varchar(128) null,
   122      `using_col2`  varchar(128) null
   123      );
   124  
   125  create table if not exists `order_detail_db_1`.`order_detail_tab_2`
   126  (
   127      `order_id`          int(11) auto_increment
   128      primary key,
   129      `item_id`  int(11),
   130      `using_col1`  varchar(128) null,
   131      `using_col2`  varchar(128) null
   132      );