From 6a66f46d4b416ce3408f8d938032d8b95265b1bb Mon Sep 17 00:00:00 2001
From: Boris Kolpackov To obtain a more canonical database schema, the names of tables
@@ -6797,7 +6797,7 @@ class employee
If instead the many side ( If instead the other side of this relationship is made inverse,
@@ -7178,10 +7178,10 @@ CREATE TABLE employee_projects (
The complete version of the code presented in this section is
@@ -8878,7 +8878,7 @@ t.commit ();
CREATE TABLE employer (
- name VARCHAR (255) NOT NULL PRIMARY KEY);
+ name VARCHAR (128) NOT NULL PRIMARY KEY);
CREATE TABLE employee (
id BIGINT UNSIGNED NOT NULL PRIMARY KEY,
- employer VARCHAR (255) NOT NULL REFERENCES employer (name));
+ employer VARCHAR (128) NOT NULL REFERENCES employer (name));
6.1.2 To-Many Relationships
@@ -6765,14 +6765,14 @@ class employee
CREATE TABLE project (
- name VARCHAR (255) NOT NULL PRIMARY KEY);
+ name VARCHAR (128) NOT NULL PRIMARY KEY);
CREATE TABLE employee (
id BIGINT UNSIGNED NOT NULL PRIMARY KEY);
CREATE TABLE employee_projects (
object_id BIGINT UNSIGNED NOT NULL,
- value VARCHAR (255) NOT NULL REFERENCES project (name));
+ value VARCHAR (128) NOT NULL REFERENCES project (name));
CREATE TABLE employee_projects (
employee_id BIGINT UNSIGNED NOT NULL,
- project_name VARCHAR (255) NOT NULL REFERENCES project (name));
+ project_name VARCHAR (128) NOT NULL REFERENCES project (name));
@@ -7101,11 +7101,11 @@ class employee
CREATE TABLE employer (
- name VARCHAR (255) NOT NULL PRIMARY KEY);
+ name VARCHAR (128) NOT NULL PRIMARY KEY);
CREATE TABLE employee (
id BIGINT UNSIGNED NOT NULL PRIMARY KEY,
- employer VARCHAR (255) NOT NULL REFERENCES employer (name));
+ employer VARCHAR (128) NOT NULL REFERENCES employer (name));
employee
) of this
@@ -7114,10 +7114,10 @@ CREATE TABLE employee (
CREATE TABLE employer (
- name VARCHAR (255) NOT NULL PRIMARY KEY);
+ name VARCHAR (128) NOT NULL PRIMARY KEY);
CREATE TABLE employer_employees (
- object_id VARCHAR (255) NOT NULL REFERENCES employer (name),
+ object_id VARCHAR (128) NOT NULL REFERENCES employer (name),
value BIGINT UNSIGNED NOT NULL REFERENCES employee (id));
CREATE TABLE employee (
@@ -7163,14 +7163,14 @@ class employee
CREATE TABLE project (
- name VARCHAR (255) NOT NULL PRIMARY KEY);
+ name VARCHAR (128) NOT NULL PRIMARY KEY);
CREATE TABLE employee (
id BIGINT UNSIGNED NOT NULL PRIMARY KEY);
CREATE TABLE employee_projects (
object_id BIGINT UNSIGNED NOT NULL REFERENCES employee (id),
- value VARCHAR (255) NOT NULL REFERENCES project (name));
+ value VARCHAR (128) NOT NULL REFERENCES project (name));
CREATE TABLE project (
- name VARCHAR (255) NOT NULL PRIMARY KEY);
+ name VARCHAR (128) NOT NULL PRIMARY KEY);
CREATE TABLE project_employees (
- object_id VARCHAR (255) NOT NULL REFERENCES project (name),
+ object_id VARCHAR (128) NOT NULL REFERENCES project (name),
value BIGINT UNSIGNED NOT NULL REFERENCES employee (id));
CREATE TABLE employee (
@@ -8594,7 +8594,7 @@ CREATE TABLE temporary_employee (
CREATE TABLE contractor (
first TEXT NOT NULL,
last TEXT NOT NULL,
- email VARCHAR (255) NOT NULL PRIMARY KEY);
+ email VARCHAR (128) NOT NULL PRIMARY KEY);
CREATE TABLE person (
id BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
- typeid VARCHAR(255) NOT NULL,
+ typeid VARCHAR(128) NOT NULL,
first TEXT NOT NULL,
last TEXT NOT NULL);
@@ -15348,7 +15348,7 @@ class person
example:
-#pragma db value(std::string) type("TEXT") id_type("VARCHAR(128)") +#pragma db value(std::string) type("TEXT") id_type("VARCHAR(64)") #pragma db object class person @@ -15356,7 +15356,7 @@ class person ... #pragma db id - std::string email_; // Mapped to VARCHAR(128) NOT NULL. + std::string email_; // Mapped to VARCHAR(64) NOT NULL. std::string name_; // Mapped to TEXT NOT NULL. }; @@ -19962,7 +19962,7 @@ person.hxx@@ -19982,7 +19982,7 @@ person.hxx differently depending on whether a member of this type is an object id or not. If the member is an object id, then for this member - std::string
+ TEXT/VARCHAR(255)
TEXT/VARCHAR(128)
NOT NULL
std::string
is mapped - to theVARCHAR(255)
MySQL type. Otherwise, + to theVARCHAR(128)
MySQL type. Otherwise, it is mapped toTEXT
.Additionally, by default, C++ enums and C++11 enum classes are @@ -26105,7 +26105,7 @@ class object
@@ -26130,7 +26130,7 @@ class object differently depending on whether a member of this type is an object id or not. If the member is an object id, then for this member - QString
+ TEXT/VARCHAR(255)
TEXT/VARCHAR(128)
NULL
QString
is mapped - to theVARCHAR(255)
MySQL type. Otherwise, + to theVARCHAR(128)
MySQL type. Otherwise, it is mapped toTEXT
.The
basic
sub-profile also provides support diff --git a/odb/relational/mysql/context.cxx b/odb/relational/mysql/context.cxx index cf75b12..3893c16 100644 --- a/odb/relational/mysql/context.cxx +++ b/odb/relational/mysql/context.cxx @@ -50,7 +50,7 @@ namespace relational {"float", "FLOAT", 0, false}, {"double", "DOUBLE", 0, false}, - {"::std::string", "TEXT", "VARCHAR(255)", false}, + {"::std::string", "TEXT", "VARCHAR(128)", false}, {"::size_t", "BIGINT UNSIGNED", 0, false}, {"::std::size_t", "BIGINT UNSIGNED", 0, false} diff --git a/odb/relational/mysql/schema.cxx b/odb/relational/mysql/schema.cxx index 5b1ad26..fe29d03 100644 --- a/odb/relational/mysql/schema.cxx +++ b/odb/relational/mysql/schema.cxx @@ -461,7 +461,7 @@ namespace relational pre_statement (); os << "CREATE TABLE IF NOT EXISTS " << qt_ << " (" << endl - << " " << qn_ << " VARCHAR(255) NOT NULL PRIMARY KEY," << endl + << " " << qn_ << " VARCHAR(128) NOT NULL PRIMARY KEY," << endl << " " << qv_ << " BIGINT UNSIGNED NOT NULL," << endl << " " << qm_ << " TINYINT(1) NOT NULL)" << endl; -- cgit v1.1