From 87dbc79ae58a2284fbf45399c7ba60f88c906d5c Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Wed, 8 Dec 2021 23:12:42 +0000 Subject: [PATCH 1/6] feat: type-reference schemas --- mssql/type-reference/README.md | 3 + mssql/type-reference/schema.sql | 0 mysql/type-reference/README.md | 3 + mysql/type-reference/schema.sql | 51 +++++++++++ postgres/type-reference/README.md | 3 + postgres/type-reference/schema.sql | 136 +++++++++++++++++++++++++++++ 6 files changed, 196 insertions(+) create mode 100644 mssql/type-reference/README.md create mode 100644 mssql/type-reference/schema.sql create mode 100644 mysql/type-reference/README.md create mode 100644 mysql/type-reference/schema.sql create mode 100644 postgres/type-reference/README.md create mode 100644 postgres/type-reference/schema.sql diff --git a/mssql/type-reference/README.md b/mssql/type-reference/README.md new file mode 100644 index 0000000..57b2d28 --- /dev/null +++ b/mssql/type-reference/README.md @@ -0,0 +1,3 @@ +# Reference schema with all available data types + +Modelled by hand after https://docs.microsoft.com/en-us/sql/t-sql/data-types/data-types-transact-sql?view=sql-server-ver15 \ No newline at end of file diff --git a/mssql/type-reference/schema.sql b/mssql/type-reference/schema.sql new file mode 100644 index 0000000..e69de29 diff --git a/mysql/type-reference/README.md b/mysql/type-reference/README.md new file mode 100644 index 0000000..1c15f1c --- /dev/null +++ b/mysql/type-reference/README.md @@ -0,0 +1,3 @@ +# Reference schema with all available data types + +Modelled by hand after https://dev.mysql.com/doc/refman/8.0/en/data-types.html \ No newline at end of file diff --git a/mysql/type-reference/schema.sql b/mysql/type-reference/schema.sql new file mode 100644 index 0000000..b1b3e56 --- /dev/null +++ b/mysql/type-reference/schema.sql @@ -0,0 +1,51 @@ +-- https://dev.mysql.com/doc/refman/8.0/en/data-types.html +CREATE TABLE `types` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `numeric_integer_tinyint` tinyint(4) NOT NULL, + `numeric_integer_smallint` smallint(6) NOT NULL, + `numeric_integer_int` int(11) NOT NULL, + `numeric_integer_bigint` bigint(20) NOT NULL, + `numeric_floating_decimal` decimal(10,0) NOT NULL, + `numeric_floating_float` float NOT NULL, + `numeric_fixed_double` double NOT NULL, + `numeric_fixed_real` double NOT NULL, + `numeric_bit` bit(64) NOT NULL, + `numeric_boolean` tinyint(1) NOT NULL, + `date_date` date NOT NULL, + `date_datetime` datetime NOT NULL, + `date_timestamp` timestamp NOT NULLP, + `date_time` time NOT NULL, + `date_year` year(4) NOT NULL, + `string_char` char(255) NOT NULL, + `string_varchar` varchar(255) NOT NULL, + `string_text_tinytext` tinytext NOT NULL, + `string_text_text` text NOT NULL, + `string_text_mediumtext` mediumtext NOT NULL, + `string_text_longtext` longtext NOT NULL, + `string_binary_binary` binary(255) NOT NULL, + `string_binary_varbinary` varbinary(255) NOT NULL, + `string_blob_tinyblob` tinyblob NOT NULL, + `string_blob_mediumblob` mediumblob NOT NULL, + `string_blob_blob` blob NOT NULL, + `string_blob_longblob` longblob NOT NULL, + `string_enum` enum('0','1','2') NOT NULL, + `string_set` set('a','b','c') NOT NULL, + `spatial_geometry` geometry NOT NULL, + `spatial_point` point NOT NULL, + `spatial_linestring` linestring NOT NULL, + `spatial_polygon` polygon NOT NULL, + `spatial_multipoint` multipoint NOT NULL, + `spatial_multilinestring` multilinestring NOT NULL, + `spatial_multipolygon` multipolygon NOT NULL, + `spatial_geometrycollection` geometrycollection NOT NULL, + `json` json NOT NULL, + PRIMARY KEY (`id`) +); + +-- https://dev.mysql.com/doc/refman/8.0/en/timestamp-initialization.html +CREATE TABLE `types_timestamp_initialization` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `date_datetime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `date_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`) +); diff --git a/postgres/type-reference/README.md b/postgres/type-reference/README.md new file mode 100644 index 0000000..cdc37c8 --- /dev/null +++ b/postgres/type-reference/README.md @@ -0,0 +1,3 @@ +# Reference schema with all available data types + +Modelled by hand after https://www.postgresql.org/docs/9.5/datatype.html \ No newline at end of file diff --git a/postgres/type-reference/schema.sql b/postgres/type-reference/schema.sql new file mode 100644 index 0000000..c1cbc18 --- /dev/null +++ b/postgres/type-reference/schema.sql @@ -0,0 +1,136 @@ +create table types ( + numeric_integer_smallint smallint, + numeric_integer_integer integer, + numeric_integer_bigint bigint, + numeric_integer_decimal decimal, + numeric_arbitrary_numeric numeric, + numeric_floating_real real, + numeric_floating_double_precision double precision, + numeric_serial_smallserial smallserial, + numeric_serial_serial serial, + numeric_serial_bigserial bigserial, + monetary_money money, + character_character_varying character varying, + character_character character, + character_varchar varchar, + character_char char, + character_text text, + binary_bytea bytea, + datetime_timestamp timestamp, + datetime_timestamp_without_time_zone timestamp without time zone, + datetime_timestamp_with_time_zone timestamp with time zone, + datetime_timestamptz timestamptz, + datetime_date date, + datetime_time time, + datetime_time_without_time_zone time without time zone, + datetime_time_with_time_zone time with time zone, + datetime_interval interval, + datetime_interval_year interval year, + datetime_interval_month interval month, + datetime_interval_day interval day, + datetime_interval_hour interval hour, + datetime_interval_minute interval minute, + datetime_interval_second interval second, + datetime_interval_year_to_month interval year to month, + datetime_interval_day_to_hour interval day to hour, + datetime_interval_day_to_minute interval day to minute, + datetime_interval_day_to_second interval day to second, + datetime_interval_hour_to_minute interval hour to minute, + datetime_interval_hour_to_second interval hour to second, + datetime_interval_minute_to_second interval minute to second, + boolean_boolean boolean, + geometric_point point, + geometric_line line, + geometric_lseg lseg, + geometric_box box, + geometric_path path, + geometric_polygon polygon, + geometric_circle circle, + network_cidr cidr, + network_inet inet, + network_macaddr macaddr, + network_macaddr8 macaddr8, + bitstring_bit bit, + bitstring_bit_varying bit varying, + textsearch_tsvector tsvector, + textsearch_tsquery tsquery, + uuid_uuid uuid, + xml_xml xml, + json_json json, + json_jsonb jsonb, + range_int4range int4range, + range_int8range int8range, + range_numrange numrange, + range_tsrange tsrange, + range_tstzrange tstzrange, + range_daterange daterange, + other_pg_lsn pg_lsn, + other_txid_snapshot txid_snapshot +) + +create table types_array1 ( + numeric_integer_smallint smallint[], + numeric_integer_integer integer[], + numeric_integer_bigint bigint[], + numeric_integer_decimal decimal[], + numeric_arbitrary_numeric numeric[], + numeric_floating_real real[], + numeric_floating_double_precision double precision[], + monetary_money money[], + character_character_varying character varying[], + character_character character[], + character_varchar varchar[], + character_char char[], + character_text text[], + binary_bytea bytea[], + datetime_timestamp timestamp[], + datetime_timestamp_without_time_zone timestamp without time zone[], + datetime_timestamp_with_time_zone timestamp with time zone[], + datetime_timestamptz timestamptz[], + datetime_date date[], + datetime_time time[], + datetime_time_without_time_zone time without time zone[], + datetime_time_with_time_zone time with time zone[], + datetime_interval interval[], + datetime_interval_year interval year[], + datetime_interval_month interval month[], + datetime_interval_day interval day[], + datetime_interval_hour interval hour[], + datetime_interval_minute interval minute[], + datetime_interval_second interval second[], + datetime_interval_year_to_month interval year to month[], + datetime_interval_day_to_hour interval day to hour[], + datetime_interval_day_to_minute interval day to minute[], + datetime_interval_day_to_second interval day to second[], + datetime_interval_hour_to_minute interval hour to minute[], + datetime_interval_hour_to_second interval hour to second[], + datetime_interval_minute_to_second interval minute to second[], + boolean_boolean boolean[], + geometric_point point[], + geometric_line line[], + geometric_lseg lseg[], + geometric_box box[], + geometric_path path[], + geometric_polygon polygon[], + geometric_circle circle[], + network_cidr cidr[], + network_inet inet[], + network_macaddr macaddr[], + network_macaddr8 macaddr8[], + bitstring_bit bit[], + bitstring_bit_varying bit varying[], + textsearch_tsvector tsvector[], + textsearch_tsquery tsquery[], + uuid_uuid uuid[], + xml_xml xml[], + json_json json[], + json_jsonb jsonb[], + range_int4range int4range[], + range_int8range int8range[], + range_numrange numrange[], + range_tsrange tsrange[], + range_tstzrange tstzrange[], + range_daterange daterange[], + other_pg_lsn pg_lsn[], + other_txid_snapshot txid_snapshot[] +) From 4c2fa4a7407ea2af9d190b5902c8265d9dd1b4b4 Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Wed, 8 Dec 2021 23:43:55 +0000 Subject: [PATCH 2/6] add comments to postgres --- postgres/type-reference/schema.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/postgres/type-reference/schema.sql b/postgres/type-reference/schema.sql index c1cbc18..83aed85 100644 --- a/postgres/type-reference/schema.sql +++ b/postgres/type-reference/schema.sql @@ -1,3 +1,4 @@ +-- https://www.postgresql.org/docs/9.5/datatype.html create table types ( numeric_integer_smallint smallint, numeric_integer_integer integer, @@ -68,6 +69,7 @@ create table types ( other_txid_snapshot txid_snapshot ) +-- https://www.postgresql.org/docs/9.1/arrays.html create table types_array1 ( numeric_integer_smallint smallint[], numeric_integer_integer integer[], From 5fc37e1188eb909b05d0ef81a1c8227efebee264 Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Wed, 8 Dec 2021 23:44:05 +0000 Subject: [PATCH 3/6] rework mysql a bit --- mysql/type-reference/schema.sql | 45 ++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/mysql/type-reference/schema.sql b/mysql/type-reference/schema.sql index b1b3e56..9032eca 100644 --- a/mysql/type-reference/schema.sql +++ b/mysql/type-reference/schema.sql @@ -1,19 +1,20 @@ -- https://dev.mysql.com/doc/refman/8.0/en/data-types.html CREATE TABLE `types` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `numeric_integer_tinyint` tinyint(4) NOT NULL, - `numeric_integer_smallint` smallint(6) NOT NULL, - `numeric_integer_int` int(11) NOT NULL, - `numeric_integer_bigint` bigint(20) NOT NULL, - `numeric_floating_decimal` decimal(10,0) NOT NULL, - `numeric_floating_float` float NOT NULL, - `numeric_fixed_double` double NOT NULL, - `numeric_fixed_real` double NOT NULL, - `numeric_bit` bit(64) NOT NULL, - `numeric_boolean` tinyint(1) NOT NULL, + `id` INT NOT NULL AUTO_INCREMENT, + `numeric_integer_tinyint` TINYINT NOT NULL, + `numeric_integer_smallint` SMALLINT NOT NULL, + `numeric_integer_mediumint` MEDIUMINT NOT NULL, + `numeric_integer_int` INT NOT NULL, + `numeric_integer_bigint` BIGINT NOT NULL, + `numeric_fixed_decimal` DECIMAL NOT NULL, + `numeric_floating_float` FLOAT NOT NULL, + `numeric_floating_double` DOUBLE NOT NULL, + `numeric_floating_real` REAL NOT NULL, + `numeric_bit` BIT NOT NULL, + `numeric_boolean` BOOL NOT NULL, `date_date` date NOT NULL, `date_datetime` datetime NOT NULL, - `date_timestamp` timestamp NOT NULLP, + `date_timestamp` timestamp NOT NULL, `date_time` time NOT NULL, `date_year` year(4) NOT NULL, `string_char` char(255) NOT NULL, @@ -49,3 +50,23 @@ CREATE TABLE `types_timestamp_initialization` ( `date_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ); + +-- https://dev.mysql.com/doc/refman/8.0/en/fixed-point-types.html +CREATE TABLE `types_fixed_point` ( + `id` INT NOT NULL AUTO_INCREMENT, + `decimal` DECIMAL NOT NULL, + `decimal_10` DECIMAL(10) NOT NULL, + `decimal_10_0` DECIMAL(10,0) NOT NULL, + `decimal_5_2` DECIMAL(5,2) NOT NULL, + PRIMARY KEY (`id`) +); + +-- https://dev.mysql.com/doc/refman/8.0/en/floating-point-types.html +TODO +CREATE TABLE `types_floating_point` ( + `id` INT NOT NULL AUTO_INCREMENT, + `numeric_floating_float` FLOAT NOT NULL, + `numeric_floating_double` DOUBLE NOT NULL, + `numeric_floating_real` REAL NOT NULL, + PRIMARY KEY (`id`) +); \ No newline at end of file From 960d28cfdeb64e7544c98696f56a0a3aa2a1bff5 Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Tue, 14 Dec 2021 22:07:22 +0000 Subject: [PATCH 4/6] moar details on mysql --- mysql/type-reference/schema.sql | 96 ++++++++++++++++++++++++++------- 1 file changed, 78 insertions(+), 18 deletions(-) diff --git a/mysql/type-reference/schema.sql b/mysql/type-reference/schema.sql index 9032eca..5704781 100644 --- a/mysql/type-reference/schema.sql +++ b/mysql/type-reference/schema.sql @@ -7,16 +7,17 @@ CREATE TABLE `types` ( `numeric_integer_int` INT NOT NULL, `numeric_integer_bigint` BIGINT NOT NULL, `numeric_fixed_decimal` DECIMAL NOT NULL, + `numeric_fixed_numeric` NUMERIC NOT NULL, -- alias to decimal `numeric_floating_float` FLOAT NOT NULL, `numeric_floating_double` DOUBLE NOT NULL, `numeric_floating_real` REAL NOT NULL, `numeric_bit` BIT NOT NULL, `numeric_boolean` BOOL NOT NULL, - `date_date` date NOT NULL, - `date_datetime` datetime NOT NULL, - `date_timestamp` timestamp NOT NULL, - `date_time` time NOT NULL, - `date_year` year(4) NOT NULL, + `date_date` DATE NOT NULL, + `date_datetime` DATETIME NOT NULL, + `date_timestamp` TIMESTAMP NOT NULL, + `date_time` TIME NOT NULL, + `date_year` YEAR NOT NULL, `string_char` char(255) NOT NULL, `string_varchar` varchar(255) NOT NULL, `string_text_tinytext` tinytext NOT NULL, @@ -43,16 +44,10 @@ CREATE TABLE `types` ( PRIMARY KEY (`id`) ); --- https://dev.mysql.com/doc/refman/8.0/en/timestamp-initialization.html -CREATE TABLE `types_timestamp_initialization` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `date_datetime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `date_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (`id`) -); +-- TODO Defaults for all columns -- https://dev.mysql.com/doc/refman/8.0/en/fixed-point-types.html -CREATE TABLE `types_fixed_point` ( +CREATE TABLE `types_numeric_fixed` ( `id` INT NOT NULL AUTO_INCREMENT, `decimal` DECIMAL NOT NULL, `decimal_10` DECIMAL(10) NOT NULL, @@ -62,11 +57,76 @@ CREATE TABLE `types_fixed_point` ( ); -- https://dev.mysql.com/doc/refman/8.0/en/floating-point-types.html -TODO -CREATE TABLE `types_floating_point` ( +CREATE TABLE `types_numeric_floating` ( `id` INT NOT NULL AUTO_INCREMENT, - `numeric_floating_float` FLOAT NOT NULL, - `numeric_floating_double` DOUBLE NOT NULL, - `numeric_floating_real` REAL NOT NULL, + `numeric_floating_float_10` FLOAT(10) NOT NULL, + `numeric_floating_float_50` FLOAT(50) NOT NULL, + `numeric_floating_double_10` DOUBLE(10) NOT NULL, + `numeric_floating_double_50` DOUBLE(50) NOT NULL, + `numeric_floating_real_10` REAL(10) NOT NULL, + `numeric_floating_real_50` REAL(50) NOT NULL, + PRIMARY KEY (`id`) +); + +-- https://dev.mysql.com/doc/refman/8.0/en/bit-type.html +CREATE TABLE `types_numeric_bit` ( + `id` INT NOT NULL AUTO_INCREMENT, + `numeric_bit_10` BIT(10) NOT NULL, + `numeric_bit_50` BIT(50) NOT NULL, + PRIMARY KEY (`id`) +); + +-- https://dev.mysql.com/doc/refman/8.0/en/numeric-type-attributes.html +CREATE TABLE `types_numeric_attributes` ( + `id` INT NOT NULL AUTO_INCREMENT, + -- display width + `numeric_integer_tinyint_width_1` TINYINT(1) UNSIGNED NOT NULL, + `numeric_integer_smallint_width_2` SMALLINT(2) UNSIGNED NOT NULL, + `numeric_integer_mediumint_width_3` MEDIUMINT(3) UNSIGNED NOT NULL, + `numeric_integer_int_width_4` INT(4) UNSIGNED NOT NULL, + `numeric_integer_bigint_width_5` BIGINT(5) UNSIGNED NOT NULL, + -- unsigned + `numeric_integer_tinyint_unsigned` TINYINT UNSIGNED NOT NULL, + `numeric_integer_smallint_unsigned` SMALLINT UNSIGNED NOT NULL, + `numeric_integer_mediumint_unsigned` MEDIUMINT UNSIGNED NOT NULL, + `numeric_integer_int_unsigned` INT UNSIGNED NOT NULL, + `numeric_integer_bigint_unsigned` BIGINT UNSIGNED NOT NULL, + -- auto_increment + `numeric_integer_tinyint_auto_increment` TINYINT AUTO_INCREMENT NOT NULL, + `numeric_integer_smallint_auto_increment` SMALLINT AUTO_INCREMENT NOT NULL, + `numeric_integer_mediumint_auto_increment` MEDIUMINT AUTO_INCREMENT NOT NULL, + `numeric_integer_int_auto_increment` INT AUTO_INCREMENT NOT NULL, + `numeric_integer_bigint_auto_increment` BIGINT AUTO_INCREMENT NOT NULL, + `numeric_fixed_decimal_auto_increment` DECIMAL AUTO_INCREMENT NOT NULL, + `numeric_fixed_numeric_auto_increment` NUMERIC AUTO_INCREMENT NOT NULL, -- alias to decimal + `numeric_floating_float_auto_increment` FLOAT AUTO_INCREMENT NOT NULL, -- deprecated in MySQL 8 + `numeric_floating_double_auto_increment` DOUBLE AUTO_INCREMENT NOT NULL, -- deprecated in MySQL 8 + `numeric_floating_real_auto_increment` REAL AUTO_INCREMENT NOT NULL, -- deprecated in MySQL 8 + PRIMARY KEY (`id`) +); + +-- https://dev.mysql.com/doc/refman/8.0/en/date-and-time-type-syntax.html +CREATE TABLE `types_date_fractional_seconds_precision` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `date_datetime_0` DATETIME(0) NOT NULL, + `date_datetime_3` DATETIME(3) NOT NULL, + `date_datetime_6` DATETIME(6) NOT NULL, + `date_timestamp_0` TIMESTAMP(0) NOT NULL, + `date_timestamp_3` TIMESTAMP(3) NOT NULL, + `date_timestamp_6` TIMESTAMP(6) NOT NULL, + `date_time_0` TIME(0) NOT NULL, + `date_time_3` TIME(3) NOT NULL, + `date_time_6` TIME(6) NOT NULL, + PRIMARY KEY (`id`) +); + +-- TODO date defaults with fsp + + +-- https://dev.mysql.com/doc/refman/8.0/en/timestamp-initialization.html +CREATE TABLE `types_date_timestamp_initialization` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `date_datetime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `date_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ); \ No newline at end of file From 9fa8739f631a68b245bf476f26b94bbd35a95763 Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Tue, 14 Dec 2021 22:18:36 +0000 Subject: [PATCH 5/6] done with dates --- mysql/type-reference/schema.sql | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mysql/type-reference/schema.sql b/mysql/type-reference/schema.sql index 5704781..6f906c0 100644 --- a/mysql/type-reference/schema.sql +++ b/mysql/type-reference/schema.sql @@ -106,6 +106,7 @@ CREATE TABLE `types_numeric_attributes` ( ); -- https://dev.mysql.com/doc/refman/8.0/en/date-and-time-type-syntax.html +-- https://dev.mysql.com/doc/refman/8.0/en/fractional-seconds.html CREATE TABLE `types_date_fractional_seconds_precision` ( `id` int(11) NOT NULL AUTO_INCREMENT, `date_datetime_0` DATETIME(0) NOT NULL, @@ -122,11 +123,14 @@ CREATE TABLE `types_date_fractional_seconds_precision` ( -- TODO date defaults with fsp - -- https://dev.mysql.com/doc/refman/8.0/en/timestamp-initialization.html CREATE TABLE `types_date_timestamp_initialization` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `date_datetime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `date_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `date_datetime_default_on_update` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `date_timestamp_default_on_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `date_datetime_default` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `date_timestamp_default` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `date_datetime_on_update` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP, + `date_timestamp_on_update` timestamp NOT NULL ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ); \ No newline at end of file From a1ee66a4a2ec7f1ad0696ad9ed128fee5f19d182 Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Tue, 14 Dec 2021 22:38:06 +0000 Subject: [PATCH 6/6] fix mysql --- mysql/type-reference/schema.sql | 42 ++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/mysql/type-reference/schema.sql b/mysql/type-reference/schema.sql index 6f906c0..fd665fd 100644 --- a/mysql/type-reference/schema.sql +++ b/mysql/type-reference/schema.sql @@ -61,10 +61,6 @@ CREATE TABLE `types_numeric_floating` ( `id` INT NOT NULL AUTO_INCREMENT, `numeric_floating_float_10` FLOAT(10) NOT NULL, `numeric_floating_float_50` FLOAT(50) NOT NULL, - `numeric_floating_double_10` DOUBLE(10) NOT NULL, - `numeric_floating_double_50` DOUBLE(50) NOT NULL, - `numeric_floating_real_10` REAL(10) NOT NULL, - `numeric_floating_real_50` REAL(50) NOT NULL, PRIMARY KEY (`id`) ); @@ -91,18 +87,48 @@ CREATE TABLE `types_numeric_attributes` ( `numeric_integer_mediumint_unsigned` MEDIUMINT UNSIGNED NOT NULL, `numeric_integer_int_unsigned` INT UNSIGNED NOT NULL, `numeric_integer_bigint_unsigned` BIGINT UNSIGNED NOT NULL, - -- auto_increment + PRIMARY KEY (`id`) +); + +-- auto_increment +CREATE TABLE `types_numeric_attributes_tinyint_auto_increment` ( `numeric_integer_tinyint_auto_increment` TINYINT AUTO_INCREMENT NOT NULL, + PRIMARY KEY (`numeric_integer_tinyint_auto_increment`) +); + +CREATE TABLE `types_numeric_attributes_smallint_auto_increment` ( `numeric_integer_smallint_auto_increment` SMALLINT AUTO_INCREMENT NOT NULL, + PRIMARY KEY (`numeric_integer_smallint_auto_increment`) +); + +CREATE TABLE `types_numeric_attributes_mediumint_auto_increment` ( `numeric_integer_mediumint_auto_increment` MEDIUMINT AUTO_INCREMENT NOT NULL, + PRIMARY KEY (`numeric_integer_mediumint_auto_increment`) +); + +CREATE TABLE `types_numeric_attributes_int_auto_increment` ( `numeric_integer_int_auto_increment` INT AUTO_INCREMENT NOT NULL, + PRIMARY KEY (`numeric_integer_int_auto_increment`) +); + +CREATE TABLE `types_numeric_attributes_bigint_auto_increment` ( `numeric_integer_bigint_auto_increment` BIGINT AUTO_INCREMENT NOT NULL, - `numeric_fixed_decimal_auto_increment` DECIMAL AUTO_INCREMENT NOT NULL, - `numeric_fixed_numeric_auto_increment` NUMERIC AUTO_INCREMENT NOT NULL, -- alias to decimal + PRIMARY KEY (`numeric_integer_bigint_auto_increment`) +); + +CREATE TABLE `types_numeric_attributes_float_auto_increment` ( `numeric_floating_float_auto_increment` FLOAT AUTO_INCREMENT NOT NULL, -- deprecated in MySQL 8 + PRIMARY KEY (`numeric_floating_float_auto_increment`) +); + +CREATE TABLE `types_numeric_attributes_double_auto_increment` ( `numeric_floating_double_auto_increment` DOUBLE AUTO_INCREMENT NOT NULL, -- deprecated in MySQL 8 + PRIMARY KEY (`numeric_floating_double_auto_increment`) +); + +CREATE TABLE `types_numeric_attributes_real_auto_increment` ( `numeric_floating_real_auto_increment` REAL AUTO_INCREMENT NOT NULL, -- deprecated in MySQL 8 - PRIMARY KEY (`id`) + PRIMARY KEY (`numeric_floating_real_auto_increment`) ); -- https://dev.mysql.com/doc/refman/8.0/en/date-and-time-type-syntax.html