2200.2.2
by Stewart Smith
add very basic ALTER TABLE protobuf message and add the DEFAULT/OFFLINE/ONLINE build method member to it, assert that we're doing the right thing. |
1 |
/*
|
2 |
Message format for ALTER TABLE commands.
|
|
3 |
*/
|
|
4 |
package drizzled.message; |
|
5 |
option optimize_for = SPEED; |
|
6 |
||
7 |
option java_package = "org.drizzle.messages"; |
|
8 |
option java_outer_classname = "AlterTableMessage"; |
|
9 |
||
10 |
message AlterTable { |
|
11 |
optional string catalog = 1; |
|
12 |
required string schema = 2; |
|
13 |
required string name = 3; |
|
14 |
||
15 |
enum BuildMethod { |
|
16 |
BUILD_DEFAULT = 0; |
|
17 |
BUILD_ONLINE = 1; |
|
18 |
BUILD_OFFLINE = 2; |
|
19 |
}
|
|
20 |
||
21 |
required BuildMethod build_method = 4 [default = BUILD_DEFAULT]; |
|
22 |
||
23 |
required bool ignore = 5 [ default = false ]; |
|
24 |
||
25 |
message AlterTableOperation { |
|
26 |
enum Operation { |
|
2200.2.4
by Stewart Smith
document the limitation on DISCARD/IMPORT tablespace in teh AlterTableOperation protobuf message |
27 |
/* Currently, the only valid DISCARD_TABLESPACE or IMPORT_TABLESPACE
|
28 |
ALTER TABLE operation is as the first and only operation */
|
|
2200.2.2
by Stewart Smith
add very basic ALTER TABLE protobuf message and add the DEFAULT/OFFLINE/ONLINE build method member to it, assert that we're doing the right thing. |
29 |
DISCARD_TABLESPACE = 0; |
30 |
IMPORT_TABLESPACE = 1; |
|
2200.2.17
by Stewart Smith
add AlterTable operations for dropping column, keys and foreign keys (by name) in the AlterTable protobuf message. |
31 |
DROP_KEY = 2; /* uses drop_name */ |
32 |
DROP_COLUMN = 3; /* uses drop_name */ |
|
33 |
DROP_FOREIGN_KEY = 4; /* uses drop_name */ |
|
2200.2.2
by Stewart Smith
add very basic ALTER TABLE protobuf message and add the DEFAULT/OFFLINE/ONLINE build method member to it, assert that we're doing the right thing. |
34 |
}
|
35 |
||
36 |
required Operation operation = 1; |
|
2200.2.17
by Stewart Smith
add AlterTable operations for dropping column, keys and foreign keys (by name) in the AlterTable protobuf message. |
37 |
|
38 |
optional string drop_name = 2;; |
|
2200.2.2
by Stewart Smith
add very basic ALTER TABLE protobuf message and add the DEFAULT/OFFLINE/ONLINE build method member to it, assert that we're doing the right thing. |
39 |
}
|
40 |
||
41 |
repeated AlterTableOperation operations = 6; |
|
2200.2.10
by Stewart Smith
add RenameTable and AlterKeysOnOff messages inside AlterTable protobuf message. We have these separate to the main repeated AlterTableOperation message as multiple invocations of these parts of ALTER TABLE have no effect (the last one in the ALTER TABLE statement is taken) |
42 |
|
43 |
message RenameTable { |
|
44 |
required string to_schema = 1; |
|
45 |
required string to_name = 2; |
|
46 |
}
|
|
47 |
||
48 |
message AlterKeysOnOff { |
|
49 |
required bool enable = 1; |
|
50 |
}
|
|
51 |
||
52 |
/* RenameTable and AlterKeysOnOff are weird as they can only exist once,
|
|
53 |
and only exist as what the last one in a ALTER TABLE statement does.
|
|
54 |
i.e. from SQL the following is valid:
|
|
55 |
CREATE TABLE t1 (a int);
|
|
56 |
CREATE TABLE t2 (a int);
|
|
57 |
ALTER TABLE t1 RENAME t2, RENAME t3;
|
|
58 |
(t1 is renamed to t3 without error or warning).
|
|
59 |
We can argue if this is insanity or not, but that's current behaviour.
|
|
60 |
*/
|
|
61 |
optional RenameTable rename = 7; |
|
62 |
optional AlterKeysOnOff alter_keys_onoff = 8; |
|
63 |
}
|