@sqlanvil/cli 1.5.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/bundle.js +1262 -20
  2. package/package.json +1 -1
  3. package/worker_bundle.js +1617 -569
package/bundle.js CHANGED
@@ -147,6 +147,7 @@ const sqlanvil = $root.sqlanvil = (() => {
147
147
  * @property {boolean|null} [includeTestsInCompiledGraph] WorkflowSettings includeTestsInCompiledGraph
148
148
  * @property {string|null} [warehouse] WorkflowSettings warehouse
149
149
  * @property {Object.<string,sqlanvil.IConnectionConfig>|null} [connections] WorkflowSettings connections
150
+ * @property {Object.<string,sqlanvil.IEnvironment>|null} [environments] WorkflowSettings environments
150
151
  */
151
152
 
152
153
  /**
@@ -160,6 +161,7 @@ const sqlanvil = $root.sqlanvil = (() => {
160
161
  function WorkflowSettings(properties) {
161
162
  this.vars = {};
162
163
  this.connections = {};
164
+ this.environments = {};
163
165
  if (properties)
164
166
  for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
165
167
  if (properties[keys[i]] != null)
@@ -310,6 +312,14 @@ const sqlanvil = $root.sqlanvil = (() => {
310
312
  */
311
313
  WorkflowSettings.prototype.connections = $util.emptyObject;
312
314
 
315
+ /**
316
+ * WorkflowSettings environments.
317
+ * @member {Object.<string,sqlanvil.IEnvironment>} environments
318
+ * @memberof sqlanvil.WorkflowSettings
319
+ * @instance
320
+ */
321
+ WorkflowSettings.prototype.environments = $util.emptyObject;
322
+
313
323
  /**
314
324
  * Creates a new WorkflowSettings instance using the specified properties.
315
325
  * @function create
@@ -374,6 +384,11 @@ const sqlanvil = $root.sqlanvil = (() => {
374
384
  writer.uint32(/* id 18, wireType 2 =*/146).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]);
375
385
  $root.sqlanvil.ConnectionConfig.encode(message.connections[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim();
376
386
  }
387
+ if (message.environments != null && Object.hasOwnProperty.call(message, "environments"))
388
+ for (let keys = Object.keys(message.environments), i = 0; i < keys.length; ++i) {
389
+ writer.uint32(/* id 19, wireType 2 =*/154).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]);
390
+ $root.sqlanvil.Environment.encode(message.environments[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim();
391
+ }
377
392
  return writer;
378
393
  };
379
394
 
@@ -520,6 +535,29 @@ const sqlanvil = $root.sqlanvil = (() => {
520
535
  message.connections[key] = value;
521
536
  break;
522
537
  }
538
+ case 19: {
539
+ if (message.environments === $util.emptyObject)
540
+ message.environments = {};
541
+ let end2 = reader.uint32() + reader.pos;
542
+ key = "";
543
+ value = null;
544
+ while (reader.pos < end2) {
545
+ let tag2 = reader.uint32();
546
+ switch (tag2 >>> 3) {
547
+ case 1:
548
+ key = reader.string();
549
+ break;
550
+ case 2:
551
+ value = $root.sqlanvil.Environment.decode(reader, reader.uint32());
552
+ break;
553
+ default:
554
+ reader.skipType(tag2 & 7);
555
+ break;
556
+ }
557
+ }
558
+ message.environments[key] = value;
559
+ break;
560
+ }
523
561
  default:
524
562
  reader.skipType(tag & 7);
525
563
  break;
@@ -627,6 +665,16 @@ const sqlanvil = $root.sqlanvil = (() => {
627
665
  return "connections." + error;
628
666
  }
629
667
  }
668
+ if (message.environments != null && message.hasOwnProperty("environments")) {
669
+ if (!$util.isObject(message.environments))
670
+ return "environments: object expected";
671
+ let key = Object.keys(message.environments);
672
+ for (let i = 0; i < key.length; ++i) {
673
+ let error = $root.sqlanvil.Environment.verify(message.environments[key[i]]);
674
+ if (error)
675
+ return "environments." + error;
676
+ }
677
+ }
630
678
  return null;
631
679
  };
632
680
 
@@ -700,6 +748,16 @@ const sqlanvil = $root.sqlanvil = (() => {
700
748
  message.connections[keys[i]] = $root.sqlanvil.ConnectionConfig.fromObject(object.connections[keys[i]]);
701
749
  }
702
750
  }
751
+ if (object.environments) {
752
+ if (typeof object.environments !== "object")
753
+ throw TypeError(".sqlanvil.WorkflowSettings.environments: object expected");
754
+ message.environments = {};
755
+ for (let keys = Object.keys(object.environments), i = 0; i < keys.length; ++i) {
756
+ if (typeof object.environments[keys[i]] !== "object")
757
+ throw TypeError(".sqlanvil.WorkflowSettings.environments: object expected");
758
+ message.environments[keys[i]] = $root.sqlanvil.Environment.fromObject(object.environments[keys[i]]);
759
+ }
760
+ }
703
761
  return message;
704
762
  };
705
763
 
@@ -719,6 +777,7 @@ const sqlanvil = $root.sqlanvil = (() => {
719
777
  if (options.objects || options.defaults) {
720
778
  object.vars = {};
721
779
  object.connections = {};
780
+ object.environments = {};
722
781
  }
723
782
  if (options.defaults) {
724
783
  object.sqlanvilCoreVersion = "";
@@ -781,6 +840,11 @@ const sqlanvil = $root.sqlanvil = (() => {
781
840
  for (let j = 0; j < keys2.length; ++j)
782
841
  object.connections[keys2[j]] = $root.sqlanvil.ConnectionConfig.toObject(message.connections[keys2[j]], options);
783
842
  }
843
+ if (message.environments && (keys2 = Object.keys(message.environments)).length) {
844
+ object.environments = {};
845
+ for (let j = 0; j < keys2.length; ++j)
846
+ object.environments[keys2[j]] = $root.sqlanvil.Environment.toObject(message.environments[keys2[j]], options);
847
+ }
784
848
  return object;
785
849
  };
786
850
 
@@ -813,6 +877,340 @@ const sqlanvil = $root.sqlanvil = (() => {
813
877
  return WorkflowSettings;
814
878
  })();
815
879
 
880
+ sqlanvil.Environment = (function() {
881
+
882
+ /**
883
+ * Properties of an Environment.
884
+ * @memberof sqlanvil
885
+ * @interface IEnvironment
886
+ * @property {string|null} [schemaSuffix] Environment schemaSuffix
887
+ * @property {Object.<string,string>|null} [vars] Environment vars
888
+ * @property {string|null} [defaultDatabase] Environment defaultDatabase
889
+ * @property {string|null} [defaultLocation] Environment defaultLocation
890
+ * @property {string|null} [credentials] Environment credentials
891
+ */
892
+
893
+ /**
894
+ * Constructs a new Environment.
895
+ * @memberof sqlanvil
896
+ * @classdesc Represents an Environment.
897
+ * @implements IEnvironment
898
+ * @constructor
899
+ * @param {sqlanvil.IEnvironment=} [properties] Properties to set
900
+ */
901
+ function Environment(properties) {
902
+ this.vars = {};
903
+ if (properties)
904
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
905
+ if (properties[keys[i]] != null)
906
+ this[keys[i]] = properties[keys[i]];
907
+ }
908
+
909
+ /**
910
+ * Environment schemaSuffix.
911
+ * @member {string} schemaSuffix
912
+ * @memberof sqlanvil.Environment
913
+ * @instance
914
+ */
915
+ Environment.prototype.schemaSuffix = "";
916
+
917
+ /**
918
+ * Environment vars.
919
+ * @member {Object.<string,string>} vars
920
+ * @memberof sqlanvil.Environment
921
+ * @instance
922
+ */
923
+ Environment.prototype.vars = $util.emptyObject;
924
+
925
+ /**
926
+ * Environment defaultDatabase.
927
+ * @member {string} defaultDatabase
928
+ * @memberof sqlanvil.Environment
929
+ * @instance
930
+ */
931
+ Environment.prototype.defaultDatabase = "";
932
+
933
+ /**
934
+ * Environment defaultLocation.
935
+ * @member {string} defaultLocation
936
+ * @memberof sqlanvil.Environment
937
+ * @instance
938
+ */
939
+ Environment.prototype.defaultLocation = "";
940
+
941
+ /**
942
+ * Environment credentials.
943
+ * @member {string} credentials
944
+ * @memberof sqlanvil.Environment
945
+ * @instance
946
+ */
947
+ Environment.prototype.credentials = "";
948
+
949
+ /**
950
+ * Creates a new Environment instance using the specified properties.
951
+ * @function create
952
+ * @memberof sqlanvil.Environment
953
+ * @static
954
+ * @param {sqlanvil.IEnvironment=} [properties] Properties to set
955
+ * @returns {sqlanvil.Environment} Environment instance
956
+ */
957
+ Environment.create = function create(properties) {
958
+ return new Environment(properties);
959
+ };
960
+
961
+ /**
962
+ * Encodes the specified Environment message. Does not implicitly {@link sqlanvil.Environment.verify|verify} messages.
963
+ * @function encode
964
+ * @memberof sqlanvil.Environment
965
+ * @static
966
+ * @param {sqlanvil.IEnvironment} message Environment message or plain object to encode
967
+ * @param {$protobuf.Writer} [writer] Writer to encode to
968
+ * @returns {$protobuf.Writer} Writer
969
+ */
970
+ Environment.encode = function encode(message, writer) {
971
+ if (!writer)
972
+ writer = $Writer.create();
973
+ if (message.schemaSuffix != null && Object.hasOwnProperty.call(message, "schemaSuffix"))
974
+ writer.uint32(/* id 1, wireType 2 =*/10).string(message.schemaSuffix);
975
+ if (message.vars != null && Object.hasOwnProperty.call(message, "vars"))
976
+ for (let keys = Object.keys(message.vars), i = 0; i < keys.length; ++i)
977
+ writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.vars[keys[i]]).ldelim();
978
+ if (message.defaultDatabase != null && Object.hasOwnProperty.call(message, "defaultDatabase"))
979
+ writer.uint32(/* id 3, wireType 2 =*/26).string(message.defaultDatabase);
980
+ if (message.defaultLocation != null && Object.hasOwnProperty.call(message, "defaultLocation"))
981
+ writer.uint32(/* id 4, wireType 2 =*/34).string(message.defaultLocation);
982
+ if (message.credentials != null && Object.hasOwnProperty.call(message, "credentials"))
983
+ writer.uint32(/* id 5, wireType 2 =*/42).string(message.credentials);
984
+ return writer;
985
+ };
986
+
987
+ /**
988
+ * Encodes the specified Environment message, length delimited. Does not implicitly {@link sqlanvil.Environment.verify|verify} messages.
989
+ * @function encodeDelimited
990
+ * @memberof sqlanvil.Environment
991
+ * @static
992
+ * @param {sqlanvil.IEnvironment} message Environment message or plain object to encode
993
+ * @param {$protobuf.Writer} [writer] Writer to encode to
994
+ * @returns {$protobuf.Writer} Writer
995
+ */
996
+ Environment.encodeDelimited = function encodeDelimited(message, writer) {
997
+ return this.encode(message, writer).ldelim();
998
+ };
999
+
1000
+ /**
1001
+ * Decodes an Environment message from the specified reader or buffer.
1002
+ * @function decode
1003
+ * @memberof sqlanvil.Environment
1004
+ * @static
1005
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1006
+ * @param {number} [length] Message length if known beforehand
1007
+ * @returns {sqlanvil.Environment} Environment
1008
+ * @throws {Error} If the payload is not a reader or valid buffer
1009
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1010
+ */
1011
+ Environment.decode = function decode(reader, length, error) {
1012
+ if (!(reader instanceof $Reader))
1013
+ reader = $Reader.create(reader);
1014
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.sqlanvil.Environment(), key, value;
1015
+ while (reader.pos < end) {
1016
+ let tag = reader.uint32();
1017
+ if (tag === error)
1018
+ break;
1019
+ switch (tag >>> 3) {
1020
+ case 1: {
1021
+ message.schemaSuffix = reader.string();
1022
+ break;
1023
+ }
1024
+ case 2: {
1025
+ if (message.vars === $util.emptyObject)
1026
+ message.vars = {};
1027
+ let end2 = reader.uint32() + reader.pos;
1028
+ key = "";
1029
+ value = "";
1030
+ while (reader.pos < end2) {
1031
+ let tag2 = reader.uint32();
1032
+ switch (tag2 >>> 3) {
1033
+ case 1:
1034
+ key = reader.string();
1035
+ break;
1036
+ case 2:
1037
+ value = reader.string();
1038
+ break;
1039
+ default:
1040
+ reader.skipType(tag2 & 7);
1041
+ break;
1042
+ }
1043
+ }
1044
+ message.vars[key] = value;
1045
+ break;
1046
+ }
1047
+ case 3: {
1048
+ message.defaultDatabase = reader.string();
1049
+ break;
1050
+ }
1051
+ case 4: {
1052
+ message.defaultLocation = reader.string();
1053
+ break;
1054
+ }
1055
+ case 5: {
1056
+ message.credentials = reader.string();
1057
+ break;
1058
+ }
1059
+ default:
1060
+ reader.skipType(tag & 7);
1061
+ break;
1062
+ }
1063
+ }
1064
+ return message;
1065
+ };
1066
+
1067
+ /**
1068
+ * Decodes an Environment message from the specified reader or buffer, length delimited.
1069
+ * @function decodeDelimited
1070
+ * @memberof sqlanvil.Environment
1071
+ * @static
1072
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1073
+ * @returns {sqlanvil.Environment} Environment
1074
+ * @throws {Error} If the payload is not a reader or valid buffer
1075
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1076
+ */
1077
+ Environment.decodeDelimited = function decodeDelimited(reader) {
1078
+ if (!(reader instanceof $Reader))
1079
+ reader = new $Reader(reader);
1080
+ return this.decode(reader, reader.uint32());
1081
+ };
1082
+
1083
+ /**
1084
+ * Verifies an Environment message.
1085
+ * @function verify
1086
+ * @memberof sqlanvil.Environment
1087
+ * @static
1088
+ * @param {Object.<string,*>} message Plain object to verify
1089
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
1090
+ */
1091
+ Environment.verify = function verify(message) {
1092
+ if (typeof message !== "object" || message === null)
1093
+ return "object expected";
1094
+ if (message.schemaSuffix != null && message.hasOwnProperty("schemaSuffix"))
1095
+ if (!$util.isString(message.schemaSuffix))
1096
+ return "schemaSuffix: string expected";
1097
+ if (message.vars != null && message.hasOwnProperty("vars")) {
1098
+ if (!$util.isObject(message.vars))
1099
+ return "vars: object expected";
1100
+ let key = Object.keys(message.vars);
1101
+ for (let i = 0; i < key.length; ++i)
1102
+ if (!$util.isString(message.vars[key[i]]))
1103
+ return "vars: string{k:string} expected";
1104
+ }
1105
+ if (message.defaultDatabase != null && message.hasOwnProperty("defaultDatabase"))
1106
+ if (!$util.isString(message.defaultDatabase))
1107
+ return "defaultDatabase: string expected";
1108
+ if (message.defaultLocation != null && message.hasOwnProperty("defaultLocation"))
1109
+ if (!$util.isString(message.defaultLocation))
1110
+ return "defaultLocation: string expected";
1111
+ if (message.credentials != null && message.hasOwnProperty("credentials"))
1112
+ if (!$util.isString(message.credentials))
1113
+ return "credentials: string expected";
1114
+ return null;
1115
+ };
1116
+
1117
+ /**
1118
+ * Creates an Environment message from a plain object. Also converts values to their respective internal types.
1119
+ * @function fromObject
1120
+ * @memberof sqlanvil.Environment
1121
+ * @static
1122
+ * @param {Object.<string,*>} object Plain object
1123
+ * @returns {sqlanvil.Environment} Environment
1124
+ */
1125
+ Environment.fromObject = function fromObject(object) {
1126
+ if (object instanceof $root.sqlanvil.Environment)
1127
+ return object;
1128
+ let message = new $root.sqlanvil.Environment();
1129
+ if (object.schemaSuffix != null)
1130
+ message.schemaSuffix = String(object.schemaSuffix);
1131
+ if (object.vars) {
1132
+ if (typeof object.vars !== "object")
1133
+ throw TypeError(".sqlanvil.Environment.vars: object expected");
1134
+ message.vars = {};
1135
+ for (let keys = Object.keys(object.vars), i = 0; i < keys.length; ++i)
1136
+ message.vars[keys[i]] = String(object.vars[keys[i]]);
1137
+ }
1138
+ if (object.defaultDatabase != null)
1139
+ message.defaultDatabase = String(object.defaultDatabase);
1140
+ if (object.defaultLocation != null)
1141
+ message.defaultLocation = String(object.defaultLocation);
1142
+ if (object.credentials != null)
1143
+ message.credentials = String(object.credentials);
1144
+ return message;
1145
+ };
1146
+
1147
+ /**
1148
+ * Creates a plain object from an Environment message. Also converts values to other types if specified.
1149
+ * @function toObject
1150
+ * @memberof sqlanvil.Environment
1151
+ * @static
1152
+ * @param {sqlanvil.Environment} message Environment
1153
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
1154
+ * @returns {Object.<string,*>} Plain object
1155
+ */
1156
+ Environment.toObject = function toObject(message, options) {
1157
+ if (!options)
1158
+ options = {};
1159
+ let object = {};
1160
+ if (options.objects || options.defaults)
1161
+ object.vars = {};
1162
+ if (options.defaults) {
1163
+ object.schemaSuffix = "";
1164
+ object.defaultDatabase = "";
1165
+ object.defaultLocation = "";
1166
+ object.credentials = "";
1167
+ }
1168
+ if (message.schemaSuffix != null && message.hasOwnProperty("schemaSuffix"))
1169
+ object.schemaSuffix = message.schemaSuffix;
1170
+ let keys2;
1171
+ if (message.vars && (keys2 = Object.keys(message.vars)).length) {
1172
+ object.vars = {};
1173
+ for (let j = 0; j < keys2.length; ++j)
1174
+ object.vars[keys2[j]] = message.vars[keys2[j]];
1175
+ }
1176
+ if (message.defaultDatabase != null && message.hasOwnProperty("defaultDatabase"))
1177
+ object.defaultDatabase = message.defaultDatabase;
1178
+ if (message.defaultLocation != null && message.hasOwnProperty("defaultLocation"))
1179
+ object.defaultLocation = message.defaultLocation;
1180
+ if (message.credentials != null && message.hasOwnProperty("credentials"))
1181
+ object.credentials = message.credentials;
1182
+ return object;
1183
+ };
1184
+
1185
+ /**
1186
+ * Converts this Environment to JSON.
1187
+ * @function toJSON
1188
+ * @memberof sqlanvil.Environment
1189
+ * @instance
1190
+ * @returns {Object.<string,*>} JSON object
1191
+ */
1192
+ Environment.prototype.toJSON = function toJSON() {
1193
+ return this.constructor.toObject(this, $protobuf__namespace.util.toJSONOptions);
1194
+ };
1195
+
1196
+ /**
1197
+ * Gets the default type url for Environment
1198
+ * @function getTypeUrl
1199
+ * @memberof sqlanvil.Environment
1200
+ * @static
1201
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
1202
+ * @returns {string} The default type url
1203
+ */
1204
+ Environment.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
1205
+ if (typeUrlPrefix === undefined) {
1206
+ typeUrlPrefix = "type.googleapis.com";
1207
+ }
1208
+ return typeUrlPrefix + "/sqlanvil.Environment";
1209
+ };
1210
+
1211
+ return Environment;
1212
+ })();
1213
+
816
1214
  sqlanvil.ConnectionConfig = (function() {
817
1215
 
818
1216
  /**
@@ -3818,6 +4216,7 @@ const sqlanvil = $root.sqlanvil = (() => {
3818
4216
  * @property {string|null} [reservation] TableConfig reservation
3819
4217
  * @property {sqlanvil.IPostgresOptions|null} [postgres] TableConfig postgres
3820
4218
  * @property {sqlanvil.ISupabaseOptions|null} [supabase] TableConfig supabase
4219
+ * @property {sqlanvil.IMysqlOptions|null} [mysql] TableConfig mysql
3821
4220
  */
3822
4221
 
3823
4222
  /**
@@ -4043,6 +4442,14 @@ const sqlanvil = $root.sqlanvil = (() => {
4043
4442
  */
4044
4443
  TableConfig.prototype.supabase = null;
4045
4444
 
4445
+ /**
4446
+ * TableConfig mysql.
4447
+ * @member {sqlanvil.IMysqlOptions|null|undefined} mysql
4448
+ * @memberof sqlanvil.ActionConfig.TableConfig
4449
+ * @instance
4450
+ */
4451
+ TableConfig.prototype.mysql = null;
4452
+
4046
4453
  /**
4047
4454
  * Creates a new TableConfig instance using the specified properties.
4048
4455
  * @function create
@@ -4125,6 +4532,8 @@ const sqlanvil = $root.sqlanvil = (() => {
4125
4532
  $root.sqlanvil.PostgresOptions.encode(message.postgres, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim();
4126
4533
  if (message.supabase != null && Object.hasOwnProperty.call(message, "supabase"))
4127
4534
  $root.sqlanvil.SupabaseOptions.encode(message.supabase, writer.uint32(/* id 26, wireType 2 =*/210).fork()).ldelim();
4535
+ if (message.mysql != null && Object.hasOwnProperty.call(message, "mysql"))
4536
+ $root.sqlanvil.MysqlOptions.encode(message.mysql, writer.uint32(/* id 27, wireType 2 =*/218).fork()).ldelim();
4128
4537
  return writer;
4129
4538
  };
4130
4539
 
@@ -4311,6 +4720,10 @@ const sqlanvil = $root.sqlanvil = (() => {
4311
4720
  message.supabase = $root.sqlanvil.SupabaseOptions.decode(reader, reader.uint32());
4312
4721
  break;
4313
4722
  }
4723
+ case 27: {
4724
+ message.mysql = $root.sqlanvil.MysqlOptions.decode(reader, reader.uint32());
4725
+ break;
4726
+ }
4314
4727
  default:
4315
4728
  reader.skipType(tag & 7);
4316
4729
  break;
@@ -4469,6 +4882,11 @@ const sqlanvil = $root.sqlanvil = (() => {
4469
4882
  if (error)
4470
4883
  return "supabase." + error;
4471
4884
  }
4885
+ if (message.mysql != null && message.hasOwnProperty("mysql")) {
4886
+ let error = $root.sqlanvil.MysqlOptions.verify(message.mysql);
4887
+ if (error)
4888
+ return "mysql." + error;
4889
+ }
4472
4890
  return null;
4473
4891
  };
4474
4892
 
@@ -4595,6 +5013,11 @@ const sqlanvil = $root.sqlanvil = (() => {
4595
5013
  throw TypeError(".sqlanvil.ActionConfig.TableConfig.supabase: object expected");
4596
5014
  message.supabase = $root.sqlanvil.SupabaseOptions.fromObject(object.supabase);
4597
5015
  }
5016
+ if (object.mysql != null) {
5017
+ if (typeof object.mysql !== "object")
5018
+ throw TypeError(".sqlanvil.ActionConfig.TableConfig.mysql: object expected");
5019
+ message.mysql = $root.sqlanvil.MysqlOptions.fromObject(object.mysql);
5020
+ }
4598
5021
  return message;
4599
5022
  };
4600
5023
 
@@ -4641,6 +5064,7 @@ const sqlanvil = $root.sqlanvil = (() => {
4641
5064
  object.reservation = "";
4642
5065
  object.postgres = null;
4643
5066
  object.supabase = null;
5067
+ object.mysql = null;
4644
5068
  }
4645
5069
  if (message.name != null && message.hasOwnProperty("name"))
4646
5070
  object.name = message.name;
@@ -4717,6 +5141,8 @@ const sqlanvil = $root.sqlanvil = (() => {
4717
5141
  object.postgres = $root.sqlanvil.PostgresOptions.toObject(message.postgres, options);
4718
5142
  if (message.supabase != null && message.hasOwnProperty("supabase"))
4719
5143
  object.supabase = $root.sqlanvil.SupabaseOptions.toObject(message.supabase, options);
5144
+ if (message.mysql != null && message.hasOwnProperty("mysql"))
5145
+ object.mysql = $root.sqlanvil.MysqlOptions.toObject(message.mysql, options);
4720
5146
  return object;
4721
5147
  };
4722
5148
 
@@ -5919,6 +6345,7 @@ const sqlanvil = $root.sqlanvil = (() => {
5919
6345
  * @property {string|null} [reservation] IncrementalTableConfig reservation
5920
6346
  * @property {sqlanvil.IPostgresOptions|null} [postgres] IncrementalTableConfig postgres
5921
6347
  * @property {sqlanvil.ISupabaseOptions|null} [supabase] IncrementalTableConfig supabase
6348
+ * @property {sqlanvil.IMysqlOptions|null} [mysql] IncrementalTableConfig mysql
5922
6349
  */
5923
6350
 
5924
6351
  /**
@@ -6177,6 +6604,14 @@ const sqlanvil = $root.sqlanvil = (() => {
6177
6604
  */
6178
6605
  IncrementalTableConfig.prototype.supabase = null;
6179
6606
 
6607
+ /**
6608
+ * IncrementalTableConfig mysql.
6609
+ * @member {sqlanvil.IMysqlOptions|null|undefined} mysql
6610
+ * @memberof sqlanvil.ActionConfig.IncrementalTableConfig
6611
+ * @instance
6612
+ */
6613
+ IncrementalTableConfig.prototype.mysql = null;
6614
+
6180
6615
  /**
6181
6616
  * Creates a new IncrementalTableConfig instance using the specified properties.
6182
6617
  * @function create
@@ -6268,6 +6703,8 @@ const sqlanvil = $root.sqlanvil = (() => {
6268
6703
  $root.sqlanvil.PostgresOptions.encode(message.postgres, writer.uint32(/* id 28, wireType 2 =*/226).fork()).ldelim();
6269
6704
  if (message.supabase != null && Object.hasOwnProperty.call(message, "supabase"))
6270
6705
  $root.sqlanvil.SupabaseOptions.encode(message.supabase, writer.uint32(/* id 29, wireType 2 =*/234).fork()).ldelim();
6706
+ if (message.mysql != null && Object.hasOwnProperty.call(message, "mysql"))
6707
+ $root.sqlanvil.MysqlOptions.encode(message.mysql, writer.uint32(/* id 30, wireType 2 =*/242).fork()).ldelim();
6271
6708
  return writer;
6272
6709
  };
6273
6710
 
@@ -6472,6 +6909,10 @@ const sqlanvil = $root.sqlanvil = (() => {
6472
6909
  message.supabase = $root.sqlanvil.SupabaseOptions.decode(reader, reader.uint32());
6473
6910
  break;
6474
6911
  }
6912
+ case 30: {
6913
+ message.mysql = $root.sqlanvil.MysqlOptions.decode(reader, reader.uint32());
6914
+ break;
6915
+ }
6475
6916
  default:
6476
6917
  reader.skipType(tag & 7);
6477
6918
  break;
@@ -6653,6 +7094,11 @@ const sqlanvil = $root.sqlanvil = (() => {
6653
7094
  if (error)
6654
7095
  return "supabase." + error;
6655
7096
  }
7097
+ if (message.mysql != null && message.hasOwnProperty("mysql")) {
7098
+ let error = $root.sqlanvil.MysqlOptions.verify(message.mysql);
7099
+ if (error)
7100
+ return "mysql." + error;
7101
+ }
6656
7102
  return null;
6657
7103
  };
6658
7104
 
@@ -6814,6 +7260,11 @@ const sqlanvil = $root.sqlanvil = (() => {
6814
7260
  throw TypeError(".sqlanvil.ActionConfig.IncrementalTableConfig.supabase: object expected");
6815
7261
  message.supabase = $root.sqlanvil.SupabaseOptions.fromObject(object.supabase);
6816
7262
  }
7263
+ if (object.mysql != null) {
7264
+ if (typeof object.mysql !== "object")
7265
+ throw TypeError(".sqlanvil.ActionConfig.IncrementalTableConfig.mysql: object expected");
7266
+ message.mysql = $root.sqlanvil.MysqlOptions.fromObject(object.mysql);
7267
+ }
6817
7268
  return message;
6818
7269
  };
6819
7270
 
@@ -6864,6 +7315,7 @@ const sqlanvil = $root.sqlanvil = (() => {
6864
7315
  object.reservation = "";
6865
7316
  object.postgres = null;
6866
7317
  object.supabase = null;
7318
+ object.mysql = null;
6867
7319
  }
6868
7320
  if (message.name != null && message.hasOwnProperty("name"))
6869
7321
  object.name = message.name;
@@ -6951,6 +7403,8 @@ const sqlanvil = $root.sqlanvil = (() => {
6951
7403
  object.postgres = $root.sqlanvil.PostgresOptions.toObject(message.postgres, options);
6952
7404
  if (message.supabase != null && message.hasOwnProperty("supabase"))
6953
7405
  object.supabase = $root.sqlanvil.SupabaseOptions.toObject(message.supabase, options);
7406
+ if (message.mysql != null && message.hasOwnProperty("mysql"))
7407
+ object.mysql = $root.sqlanvil.MysqlOptions.toObject(message.mysql, options);
6954
7408
  return object;
6955
7409
  };
6956
7410
 
@@ -13411,6 +13865,572 @@ const sqlanvil = $root.sqlanvil = (() => {
13411
13865
  return PostgresOptions;
13412
13866
  })();
13413
13867
 
13868
+ sqlanvil.MysqlOptions = (function() {
13869
+
13870
+ /**
13871
+ * Properties of a MysqlOptions.
13872
+ * @memberof sqlanvil
13873
+ * @interface IMysqlOptions
13874
+ * @property {string|null} [engine] MysqlOptions engine
13875
+ * @property {string|null} [charset] MysqlOptions charset
13876
+ * @property {string|null} [collation] MysqlOptions collation
13877
+ * @property {Array.<sqlanvil.MysqlOptions.IIndex>|null} [indexes] MysqlOptions indexes
13878
+ */
13879
+
13880
+ /**
13881
+ * Constructs a new MysqlOptions.
13882
+ * @memberof sqlanvil
13883
+ * @classdesc Represents a MysqlOptions.
13884
+ * @implements IMysqlOptions
13885
+ * @constructor
13886
+ * @param {sqlanvil.IMysqlOptions=} [properties] Properties to set
13887
+ */
13888
+ function MysqlOptions(properties) {
13889
+ this.indexes = [];
13890
+ if (properties)
13891
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
13892
+ if (properties[keys[i]] != null)
13893
+ this[keys[i]] = properties[keys[i]];
13894
+ }
13895
+
13896
+ /**
13897
+ * MysqlOptions engine.
13898
+ * @member {string} engine
13899
+ * @memberof sqlanvil.MysqlOptions
13900
+ * @instance
13901
+ */
13902
+ MysqlOptions.prototype.engine = "";
13903
+
13904
+ /**
13905
+ * MysqlOptions charset.
13906
+ * @member {string} charset
13907
+ * @memberof sqlanvil.MysqlOptions
13908
+ * @instance
13909
+ */
13910
+ MysqlOptions.prototype.charset = "";
13911
+
13912
+ /**
13913
+ * MysqlOptions collation.
13914
+ * @member {string} collation
13915
+ * @memberof sqlanvil.MysqlOptions
13916
+ * @instance
13917
+ */
13918
+ MysqlOptions.prototype.collation = "";
13919
+
13920
+ /**
13921
+ * MysqlOptions indexes.
13922
+ * @member {Array.<sqlanvil.MysqlOptions.IIndex>} indexes
13923
+ * @memberof sqlanvil.MysqlOptions
13924
+ * @instance
13925
+ */
13926
+ MysqlOptions.prototype.indexes = $util.emptyArray;
13927
+
13928
+ /**
13929
+ * Creates a new MysqlOptions instance using the specified properties.
13930
+ * @function create
13931
+ * @memberof sqlanvil.MysqlOptions
13932
+ * @static
13933
+ * @param {sqlanvil.IMysqlOptions=} [properties] Properties to set
13934
+ * @returns {sqlanvil.MysqlOptions} MysqlOptions instance
13935
+ */
13936
+ MysqlOptions.create = function create(properties) {
13937
+ return new MysqlOptions(properties);
13938
+ };
13939
+
13940
+ /**
13941
+ * Encodes the specified MysqlOptions message. Does not implicitly {@link sqlanvil.MysqlOptions.verify|verify} messages.
13942
+ * @function encode
13943
+ * @memberof sqlanvil.MysqlOptions
13944
+ * @static
13945
+ * @param {sqlanvil.IMysqlOptions} message MysqlOptions message or plain object to encode
13946
+ * @param {$protobuf.Writer} [writer] Writer to encode to
13947
+ * @returns {$protobuf.Writer} Writer
13948
+ */
13949
+ MysqlOptions.encode = function encode(message, writer) {
13950
+ if (!writer)
13951
+ writer = $Writer.create();
13952
+ if (message.engine != null && Object.hasOwnProperty.call(message, "engine"))
13953
+ writer.uint32(/* id 1, wireType 2 =*/10).string(message.engine);
13954
+ if (message.charset != null && Object.hasOwnProperty.call(message, "charset"))
13955
+ writer.uint32(/* id 2, wireType 2 =*/18).string(message.charset);
13956
+ if (message.collation != null && Object.hasOwnProperty.call(message, "collation"))
13957
+ writer.uint32(/* id 3, wireType 2 =*/26).string(message.collation);
13958
+ if (message.indexes != null && message.indexes.length)
13959
+ for (let i = 0; i < message.indexes.length; ++i)
13960
+ $root.sqlanvil.MysqlOptions.Index.encode(message.indexes[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
13961
+ return writer;
13962
+ };
13963
+
13964
+ /**
13965
+ * Encodes the specified MysqlOptions message, length delimited. Does not implicitly {@link sqlanvil.MysqlOptions.verify|verify} messages.
13966
+ * @function encodeDelimited
13967
+ * @memberof sqlanvil.MysqlOptions
13968
+ * @static
13969
+ * @param {sqlanvil.IMysqlOptions} message MysqlOptions message or plain object to encode
13970
+ * @param {$protobuf.Writer} [writer] Writer to encode to
13971
+ * @returns {$protobuf.Writer} Writer
13972
+ */
13973
+ MysqlOptions.encodeDelimited = function encodeDelimited(message, writer) {
13974
+ return this.encode(message, writer).ldelim();
13975
+ };
13976
+
13977
+ /**
13978
+ * Decodes a MysqlOptions message from the specified reader or buffer.
13979
+ * @function decode
13980
+ * @memberof sqlanvil.MysqlOptions
13981
+ * @static
13982
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
13983
+ * @param {number} [length] Message length if known beforehand
13984
+ * @returns {sqlanvil.MysqlOptions} MysqlOptions
13985
+ * @throws {Error} If the payload is not a reader or valid buffer
13986
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
13987
+ */
13988
+ MysqlOptions.decode = function decode(reader, length, error) {
13989
+ if (!(reader instanceof $Reader))
13990
+ reader = $Reader.create(reader);
13991
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.sqlanvil.MysqlOptions();
13992
+ while (reader.pos < end) {
13993
+ let tag = reader.uint32();
13994
+ if (tag === error)
13995
+ break;
13996
+ switch (tag >>> 3) {
13997
+ case 1: {
13998
+ message.engine = reader.string();
13999
+ break;
14000
+ }
14001
+ case 2: {
14002
+ message.charset = reader.string();
14003
+ break;
14004
+ }
14005
+ case 3: {
14006
+ message.collation = reader.string();
14007
+ break;
14008
+ }
14009
+ case 4: {
14010
+ if (!(message.indexes && message.indexes.length))
14011
+ message.indexes = [];
14012
+ message.indexes.push($root.sqlanvil.MysqlOptions.Index.decode(reader, reader.uint32()));
14013
+ break;
14014
+ }
14015
+ default:
14016
+ reader.skipType(tag & 7);
14017
+ break;
14018
+ }
14019
+ }
14020
+ return message;
14021
+ };
14022
+
14023
+ /**
14024
+ * Decodes a MysqlOptions message from the specified reader or buffer, length delimited.
14025
+ * @function decodeDelimited
14026
+ * @memberof sqlanvil.MysqlOptions
14027
+ * @static
14028
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
14029
+ * @returns {sqlanvil.MysqlOptions} MysqlOptions
14030
+ * @throws {Error} If the payload is not a reader or valid buffer
14031
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
14032
+ */
14033
+ MysqlOptions.decodeDelimited = function decodeDelimited(reader) {
14034
+ if (!(reader instanceof $Reader))
14035
+ reader = new $Reader(reader);
14036
+ return this.decode(reader, reader.uint32());
14037
+ };
14038
+
14039
+ /**
14040
+ * Verifies a MysqlOptions message.
14041
+ * @function verify
14042
+ * @memberof sqlanvil.MysqlOptions
14043
+ * @static
14044
+ * @param {Object.<string,*>} message Plain object to verify
14045
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
14046
+ */
14047
+ MysqlOptions.verify = function verify(message) {
14048
+ if (typeof message !== "object" || message === null)
14049
+ return "object expected";
14050
+ if (message.engine != null && message.hasOwnProperty("engine"))
14051
+ if (!$util.isString(message.engine))
14052
+ return "engine: string expected";
14053
+ if (message.charset != null && message.hasOwnProperty("charset"))
14054
+ if (!$util.isString(message.charset))
14055
+ return "charset: string expected";
14056
+ if (message.collation != null && message.hasOwnProperty("collation"))
14057
+ if (!$util.isString(message.collation))
14058
+ return "collation: string expected";
14059
+ if (message.indexes != null && message.hasOwnProperty("indexes")) {
14060
+ if (!Array.isArray(message.indexes))
14061
+ return "indexes: array expected";
14062
+ for (let i = 0; i < message.indexes.length; ++i) {
14063
+ let error = $root.sqlanvil.MysqlOptions.Index.verify(message.indexes[i]);
14064
+ if (error)
14065
+ return "indexes." + error;
14066
+ }
14067
+ }
14068
+ return null;
14069
+ };
14070
+
14071
+ /**
14072
+ * Creates a MysqlOptions message from a plain object. Also converts values to their respective internal types.
14073
+ * @function fromObject
14074
+ * @memberof sqlanvil.MysqlOptions
14075
+ * @static
14076
+ * @param {Object.<string,*>} object Plain object
14077
+ * @returns {sqlanvil.MysqlOptions} MysqlOptions
14078
+ */
14079
+ MysqlOptions.fromObject = function fromObject(object) {
14080
+ if (object instanceof $root.sqlanvil.MysqlOptions)
14081
+ return object;
14082
+ let message = new $root.sqlanvil.MysqlOptions();
14083
+ if (object.engine != null)
14084
+ message.engine = String(object.engine);
14085
+ if (object.charset != null)
14086
+ message.charset = String(object.charset);
14087
+ if (object.collation != null)
14088
+ message.collation = String(object.collation);
14089
+ if (object.indexes) {
14090
+ if (!Array.isArray(object.indexes))
14091
+ throw TypeError(".sqlanvil.MysqlOptions.indexes: array expected");
14092
+ message.indexes = [];
14093
+ for (let i = 0; i < object.indexes.length; ++i) {
14094
+ if (typeof object.indexes[i] !== "object")
14095
+ throw TypeError(".sqlanvil.MysqlOptions.indexes: object expected");
14096
+ message.indexes[i] = $root.sqlanvil.MysqlOptions.Index.fromObject(object.indexes[i]);
14097
+ }
14098
+ }
14099
+ return message;
14100
+ };
14101
+
14102
+ /**
14103
+ * Creates a plain object from a MysqlOptions message. Also converts values to other types if specified.
14104
+ * @function toObject
14105
+ * @memberof sqlanvil.MysqlOptions
14106
+ * @static
14107
+ * @param {sqlanvil.MysqlOptions} message MysqlOptions
14108
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
14109
+ * @returns {Object.<string,*>} Plain object
14110
+ */
14111
+ MysqlOptions.toObject = function toObject(message, options) {
14112
+ if (!options)
14113
+ options = {};
14114
+ let object = {};
14115
+ if (options.arrays || options.defaults)
14116
+ object.indexes = [];
14117
+ if (options.defaults) {
14118
+ object.engine = "";
14119
+ object.charset = "";
14120
+ object.collation = "";
14121
+ }
14122
+ if (message.engine != null && message.hasOwnProperty("engine"))
14123
+ object.engine = message.engine;
14124
+ if (message.charset != null && message.hasOwnProperty("charset"))
14125
+ object.charset = message.charset;
14126
+ if (message.collation != null && message.hasOwnProperty("collation"))
14127
+ object.collation = message.collation;
14128
+ if (message.indexes && message.indexes.length) {
14129
+ object.indexes = [];
14130
+ for (let j = 0; j < message.indexes.length; ++j)
14131
+ object.indexes[j] = $root.sqlanvil.MysqlOptions.Index.toObject(message.indexes[j], options);
14132
+ }
14133
+ return object;
14134
+ };
14135
+
14136
+ /**
14137
+ * Converts this MysqlOptions to JSON.
14138
+ * @function toJSON
14139
+ * @memberof sqlanvil.MysqlOptions
14140
+ * @instance
14141
+ * @returns {Object.<string,*>} JSON object
14142
+ */
14143
+ MysqlOptions.prototype.toJSON = function toJSON() {
14144
+ return this.constructor.toObject(this, $protobuf__namespace.util.toJSONOptions);
14145
+ };
14146
+
14147
+ /**
14148
+ * Gets the default type url for MysqlOptions
14149
+ * @function getTypeUrl
14150
+ * @memberof sqlanvil.MysqlOptions
14151
+ * @static
14152
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
14153
+ * @returns {string} The default type url
14154
+ */
14155
+ MysqlOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
14156
+ if (typeUrlPrefix === undefined) {
14157
+ typeUrlPrefix = "type.googleapis.com";
14158
+ }
14159
+ return typeUrlPrefix + "/sqlanvil.MysqlOptions";
14160
+ };
14161
+
14162
+ MysqlOptions.Index = (function() {
14163
+
14164
+ /**
14165
+ * Properties of an Index.
14166
+ * @memberof sqlanvil.MysqlOptions
14167
+ * @interface IIndex
14168
+ * @property {string|null} [name] Index name
14169
+ * @property {Array.<string>|null} [columns] Index columns
14170
+ * @property {boolean|null} [unique] Index unique
14171
+ */
14172
+
14173
+ /**
14174
+ * Constructs a new Index.
14175
+ * @memberof sqlanvil.MysqlOptions
14176
+ * @classdesc Represents an Index.
14177
+ * @implements IIndex
14178
+ * @constructor
14179
+ * @param {sqlanvil.MysqlOptions.IIndex=} [properties] Properties to set
14180
+ */
14181
+ function Index(properties) {
14182
+ this.columns = [];
14183
+ if (properties)
14184
+ for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
14185
+ if (properties[keys[i]] != null)
14186
+ this[keys[i]] = properties[keys[i]];
14187
+ }
14188
+
14189
+ /**
14190
+ * Index name.
14191
+ * @member {string} name
14192
+ * @memberof sqlanvil.MysqlOptions.Index
14193
+ * @instance
14194
+ */
14195
+ Index.prototype.name = "";
14196
+
14197
+ /**
14198
+ * Index columns.
14199
+ * @member {Array.<string>} columns
14200
+ * @memberof sqlanvil.MysqlOptions.Index
14201
+ * @instance
14202
+ */
14203
+ Index.prototype.columns = $util.emptyArray;
14204
+
14205
+ /**
14206
+ * Index unique.
14207
+ * @member {boolean} unique
14208
+ * @memberof sqlanvil.MysqlOptions.Index
14209
+ * @instance
14210
+ */
14211
+ Index.prototype.unique = false;
14212
+
14213
+ /**
14214
+ * Creates a new Index instance using the specified properties.
14215
+ * @function create
14216
+ * @memberof sqlanvil.MysqlOptions.Index
14217
+ * @static
14218
+ * @param {sqlanvil.MysqlOptions.IIndex=} [properties] Properties to set
14219
+ * @returns {sqlanvil.MysqlOptions.Index} Index instance
14220
+ */
14221
+ Index.create = function create(properties) {
14222
+ return new Index(properties);
14223
+ };
14224
+
14225
+ /**
14226
+ * Encodes the specified Index message. Does not implicitly {@link sqlanvil.MysqlOptions.Index.verify|verify} messages.
14227
+ * @function encode
14228
+ * @memberof sqlanvil.MysqlOptions.Index
14229
+ * @static
14230
+ * @param {sqlanvil.MysqlOptions.IIndex} message Index message or plain object to encode
14231
+ * @param {$protobuf.Writer} [writer] Writer to encode to
14232
+ * @returns {$protobuf.Writer} Writer
14233
+ */
14234
+ Index.encode = function encode(message, writer) {
14235
+ if (!writer)
14236
+ writer = $Writer.create();
14237
+ if (message.name != null && Object.hasOwnProperty.call(message, "name"))
14238
+ writer.uint32(/* id 1, wireType 2 =*/10).string(message.name);
14239
+ if (message.columns != null && message.columns.length)
14240
+ for (let i = 0; i < message.columns.length; ++i)
14241
+ writer.uint32(/* id 2, wireType 2 =*/18).string(message.columns[i]);
14242
+ if (message.unique != null && Object.hasOwnProperty.call(message, "unique"))
14243
+ writer.uint32(/* id 3, wireType 0 =*/24).bool(message.unique);
14244
+ return writer;
14245
+ };
14246
+
14247
+ /**
14248
+ * Encodes the specified Index message, length delimited. Does not implicitly {@link sqlanvil.MysqlOptions.Index.verify|verify} messages.
14249
+ * @function encodeDelimited
14250
+ * @memberof sqlanvil.MysqlOptions.Index
14251
+ * @static
14252
+ * @param {sqlanvil.MysqlOptions.IIndex} message Index message or plain object to encode
14253
+ * @param {$protobuf.Writer} [writer] Writer to encode to
14254
+ * @returns {$protobuf.Writer} Writer
14255
+ */
14256
+ Index.encodeDelimited = function encodeDelimited(message, writer) {
14257
+ return this.encode(message, writer).ldelim();
14258
+ };
14259
+
14260
+ /**
14261
+ * Decodes an Index message from the specified reader or buffer.
14262
+ * @function decode
14263
+ * @memberof sqlanvil.MysqlOptions.Index
14264
+ * @static
14265
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
14266
+ * @param {number} [length] Message length if known beforehand
14267
+ * @returns {sqlanvil.MysqlOptions.Index} Index
14268
+ * @throws {Error} If the payload is not a reader or valid buffer
14269
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
14270
+ */
14271
+ Index.decode = function decode(reader, length, error) {
14272
+ if (!(reader instanceof $Reader))
14273
+ reader = $Reader.create(reader);
14274
+ let end = length === undefined ? reader.len : reader.pos + length, message = new $root.sqlanvil.MysqlOptions.Index();
14275
+ while (reader.pos < end) {
14276
+ let tag = reader.uint32();
14277
+ if (tag === error)
14278
+ break;
14279
+ switch (tag >>> 3) {
14280
+ case 1: {
14281
+ message.name = reader.string();
14282
+ break;
14283
+ }
14284
+ case 2: {
14285
+ if (!(message.columns && message.columns.length))
14286
+ message.columns = [];
14287
+ message.columns.push(reader.string());
14288
+ break;
14289
+ }
14290
+ case 3: {
14291
+ message.unique = reader.bool();
14292
+ break;
14293
+ }
14294
+ default:
14295
+ reader.skipType(tag & 7);
14296
+ break;
14297
+ }
14298
+ }
14299
+ return message;
14300
+ };
14301
+
14302
+ /**
14303
+ * Decodes an Index message from the specified reader or buffer, length delimited.
14304
+ * @function decodeDelimited
14305
+ * @memberof sqlanvil.MysqlOptions.Index
14306
+ * @static
14307
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
14308
+ * @returns {sqlanvil.MysqlOptions.Index} Index
14309
+ * @throws {Error} If the payload is not a reader or valid buffer
14310
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
14311
+ */
14312
+ Index.decodeDelimited = function decodeDelimited(reader) {
14313
+ if (!(reader instanceof $Reader))
14314
+ reader = new $Reader(reader);
14315
+ return this.decode(reader, reader.uint32());
14316
+ };
14317
+
14318
+ /**
14319
+ * Verifies an Index message.
14320
+ * @function verify
14321
+ * @memberof sqlanvil.MysqlOptions.Index
14322
+ * @static
14323
+ * @param {Object.<string,*>} message Plain object to verify
14324
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
14325
+ */
14326
+ Index.verify = function verify(message) {
14327
+ if (typeof message !== "object" || message === null)
14328
+ return "object expected";
14329
+ if (message.name != null && message.hasOwnProperty("name"))
14330
+ if (!$util.isString(message.name))
14331
+ return "name: string expected";
14332
+ if (message.columns != null && message.hasOwnProperty("columns")) {
14333
+ if (!Array.isArray(message.columns))
14334
+ return "columns: array expected";
14335
+ for (let i = 0; i < message.columns.length; ++i)
14336
+ if (!$util.isString(message.columns[i]))
14337
+ return "columns: string[] expected";
14338
+ }
14339
+ if (message.unique != null && message.hasOwnProperty("unique"))
14340
+ if (typeof message.unique !== "boolean")
14341
+ return "unique: boolean expected";
14342
+ return null;
14343
+ };
14344
+
14345
+ /**
14346
+ * Creates an Index message from a plain object. Also converts values to their respective internal types.
14347
+ * @function fromObject
14348
+ * @memberof sqlanvil.MysqlOptions.Index
14349
+ * @static
14350
+ * @param {Object.<string,*>} object Plain object
14351
+ * @returns {sqlanvil.MysqlOptions.Index} Index
14352
+ */
14353
+ Index.fromObject = function fromObject(object) {
14354
+ if (object instanceof $root.sqlanvil.MysqlOptions.Index)
14355
+ return object;
14356
+ let message = new $root.sqlanvil.MysqlOptions.Index();
14357
+ if (object.name != null)
14358
+ message.name = String(object.name);
14359
+ if (object.columns) {
14360
+ if (!Array.isArray(object.columns))
14361
+ throw TypeError(".sqlanvil.MysqlOptions.Index.columns: array expected");
14362
+ message.columns = [];
14363
+ for (let i = 0; i < object.columns.length; ++i)
14364
+ message.columns[i] = String(object.columns[i]);
14365
+ }
14366
+ if (object.unique != null)
14367
+ message.unique = Boolean(object.unique);
14368
+ return message;
14369
+ };
14370
+
14371
+ /**
14372
+ * Creates a plain object from an Index message. Also converts values to other types if specified.
14373
+ * @function toObject
14374
+ * @memberof sqlanvil.MysqlOptions.Index
14375
+ * @static
14376
+ * @param {sqlanvil.MysqlOptions.Index} message Index
14377
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
14378
+ * @returns {Object.<string,*>} Plain object
14379
+ */
14380
+ Index.toObject = function toObject(message, options) {
14381
+ if (!options)
14382
+ options = {};
14383
+ let object = {};
14384
+ if (options.arrays || options.defaults)
14385
+ object.columns = [];
14386
+ if (options.defaults) {
14387
+ object.name = "";
14388
+ object.unique = false;
14389
+ }
14390
+ if (message.name != null && message.hasOwnProperty("name"))
14391
+ object.name = message.name;
14392
+ if (message.columns && message.columns.length) {
14393
+ object.columns = [];
14394
+ for (let j = 0; j < message.columns.length; ++j)
14395
+ object.columns[j] = message.columns[j];
14396
+ }
14397
+ if (message.unique != null && message.hasOwnProperty("unique"))
14398
+ object.unique = message.unique;
14399
+ return object;
14400
+ };
14401
+
14402
+ /**
14403
+ * Converts this Index to JSON.
14404
+ * @function toJSON
14405
+ * @memberof sqlanvil.MysqlOptions.Index
14406
+ * @instance
14407
+ * @returns {Object.<string,*>} JSON object
14408
+ */
14409
+ Index.prototype.toJSON = function toJSON() {
14410
+ return this.constructor.toObject(this, $protobuf__namespace.util.toJSONOptions);
14411
+ };
14412
+
14413
+ /**
14414
+ * Gets the default type url for Index
14415
+ * @function getTypeUrl
14416
+ * @memberof sqlanvil.MysqlOptions.Index
14417
+ * @static
14418
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
14419
+ * @returns {string} The default type url
14420
+ */
14421
+ Index.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
14422
+ if (typeUrlPrefix === undefined) {
14423
+ typeUrlPrefix = "type.googleapis.com";
14424
+ }
14425
+ return typeUrlPrefix + "/sqlanvil.MysqlOptions.Index";
14426
+ };
14427
+
14428
+ return Index;
14429
+ })();
14430
+
14431
+ return MysqlOptions;
14432
+ })();
14433
+
13414
14434
  sqlanvil.SupabaseOptions = (function() {
13415
14435
 
13416
14436
  /**
@@ -19410,6 +20430,7 @@ const sqlanvil = $root.sqlanvil = (() => {
19410
20430
  * @property {sqlanvil.IBigQueryOptions|null} [bigquery] Table bigquery
19411
20431
  * @property {sqlanvil.IPostgresOptions|null} [postgres] Table postgres
19412
20432
  * @property {sqlanvil.ISupabaseOptions|null} [supabase] Table supabase
20433
+ * @property {sqlanvil.IMysqlOptions|null} [mysql] Table mysql
19413
20434
  * @property {string|null} [fileName] Table fileName
19414
20435
  */
19415
20436
 
@@ -19627,6 +20648,14 @@ const sqlanvil = $root.sqlanvil = (() => {
19627
20648
  */
19628
20649
  Table.prototype.supabase = null;
19629
20650
 
20651
+ /**
20652
+ * Table mysql.
20653
+ * @member {sqlanvil.IMysqlOptions|null|undefined} mysql
20654
+ * @memberof sqlanvil.Table
20655
+ * @instance
20656
+ */
20657
+ Table.prototype.mysql = null;
20658
+
19630
20659
  /**
19631
20660
  * Table fileName.
19632
20661
  * @member {string} fileName
@@ -19716,6 +20745,8 @@ const sqlanvil = $root.sqlanvil = (() => {
19716
20745
  $root.sqlanvil.PostgresOptions.encode(message.postgres, writer.uint32(/* id 39, wireType 2 =*/314).fork()).ldelim();
19717
20746
  if (message.supabase != null && Object.hasOwnProperty.call(message, "supabase"))
19718
20747
  $root.sqlanvil.SupabaseOptions.encode(message.supabase, writer.uint32(/* id 40, wireType 2 =*/322).fork()).ldelim();
20748
+ if (message.mysql != null && Object.hasOwnProperty.call(message, "mysql"))
20749
+ $root.sqlanvil.MysqlOptions.encode(message.mysql, writer.uint32(/* id 41, wireType 2 =*/330).fork()).ldelim();
19719
20750
  return writer;
19720
20751
  };
19721
20752
 
@@ -19862,6 +20893,10 @@ const sqlanvil = $root.sqlanvil = (() => {
19862
20893
  message.supabase = $root.sqlanvil.SupabaseOptions.decode(reader, reader.uint32());
19863
20894
  break;
19864
20895
  }
20896
+ case 41: {
20897
+ message.mysql = $root.sqlanvil.MysqlOptions.decode(reader, reader.uint32());
20898
+ break;
20899
+ }
19865
20900
  case 18: {
19866
20901
  message.fileName = reader.string();
19867
20902
  break;
@@ -20035,6 +21070,11 @@ const sqlanvil = $root.sqlanvil = (() => {
20035
21070
  if (error)
20036
21071
  return "supabase." + error;
20037
21072
  }
21073
+ if (message.mysql != null && message.hasOwnProperty("mysql")) {
21074
+ let error = $root.sqlanvil.MysqlOptions.verify(message.mysql);
21075
+ if (error)
21076
+ return "mysql." + error;
21077
+ }
20038
21078
  if (message.fileName != null && message.hasOwnProperty("fileName"))
20039
21079
  if (!$util.isString(message.fileName))
20040
21080
  return "fileName: string expected";
@@ -20219,6 +21259,11 @@ const sqlanvil = $root.sqlanvil = (() => {
20219
21259
  throw TypeError(".sqlanvil.Table.supabase: object expected");
20220
21260
  message.supabase = $root.sqlanvil.SupabaseOptions.fromObject(object.supabase);
20221
21261
  }
21262
+ if (object.mysql != null) {
21263
+ if (typeof object.mysql !== "object")
21264
+ throw TypeError(".sqlanvil.Table.mysql: object expected");
21265
+ message.mysql = $root.sqlanvil.MysqlOptions.fromObject(object.mysql);
21266
+ }
20222
21267
  if (object.fileName != null)
20223
21268
  message.fileName = String(object.fileName);
20224
21269
  return message;
@@ -20265,6 +21310,7 @@ const sqlanvil = $root.sqlanvil = (() => {
20265
21310
  object.jitCode = "";
20266
21311
  object.postgres = null;
20267
21312
  object.supabase = null;
21313
+ object.mysql = null;
20268
21314
  }
20269
21315
  if (message.type != null && message.hasOwnProperty("type"))
20270
21316
  object.type = message.type;
@@ -20337,6 +21383,8 @@ const sqlanvil = $root.sqlanvil = (() => {
20337
21383
  object.postgres = $root.sqlanvil.PostgresOptions.toObject(message.postgres, options);
20338
21384
  if (message.supabase != null && message.hasOwnProperty("supabase"))
20339
21385
  object.supabase = $root.sqlanvil.SupabaseOptions.toObject(message.supabase, options);
21386
+ if (message.mysql != null && message.hasOwnProperty("mysql"))
21387
+ object.mysql = $root.sqlanvil.MysqlOptions.toObject(message.mysql, options);
20340
21388
  return object;
20341
21389
  };
20342
21390
 
@@ -38650,8 +39698,11 @@ class MysqlExecutionSql {
38650
39698
  const target = this.resolveTarget(table.target);
38651
39699
  if (table.enumType === sqlanvil.TableType.VIEW) {
38652
39700
  if (table.materialized) {
38653
- throw new Error(`Materialized views are not supported on mysql (action ${target}). ` +
38654
- `Use a table, or emulate refresh via operations.`);
39701
+ tasks.add(Task.statement(this.dropIfExists(table.target, sqlanvil.TableMetadata.Type.VIEW)));
39702
+ tasks.add(Task.statement(this.dropIfExists(table.target, sqlanvil.TableMetadata.Type.TABLE)));
39703
+ tasks.add(Task.statement(`create table ${target}${this.tableOptions(table)} as ${table.query}`));
39704
+ this.createIndexes(table).forEach(stmt => tasks.add(Task.statement(stmt)));
39705
+ return tasks;
38655
39706
  }
38656
39707
  tasks.add(Task.statement(`create or replace view ${target} as ${table.query}`));
38657
39708
  return tasks;
@@ -38660,12 +39711,13 @@ class MysqlExecutionSql {
38660
39711
  const fresh = !this.shouldWriteIncrementally(table, runConfig, tableMetadata);
38661
39712
  if (fresh) {
38662
39713
  tasks.add(Task.statement(this.dropIfExists(table.target, sqlanvil.TableMetadata.Type.TABLE)));
38663
- tasks.add(Task.statement(`create table ${target} as ${table.query}`));
39714
+ tasks.add(Task.statement(`create table ${target}${this.tableOptions(table)} as ${table.query}`));
38664
39715
  if (table.uniqueKey && table.uniqueKey.length > 0) {
38665
39716
  const idx = `uq_${table.target.schema}_${table.target.name}`.slice(0, 63);
38666
39717
  const cols = table.uniqueKey.map(k => `\`${k}\``).join(", ");
38667
39718
  tasks.add(Task.statement(`alter table ${target} add unique index \`${idx}\` (${cols})`));
38668
39719
  }
39720
+ this.createIndexes(table).forEach(stmt => tasks.add(Task.statement(stmt)));
38669
39721
  }
38670
39722
  else {
38671
39723
  tasks.add(Task.statement(this.upsertInto(table, tableMetadata)));
@@ -38673,7 +39725,8 @@ class MysqlExecutionSql {
38673
39725
  return tasks;
38674
39726
  }
38675
39727
  tasks.add(Task.statement(this.dropIfExists(table.target, sqlanvil.TableMetadata.Type.TABLE)));
38676
- tasks.add(Task.statement(`create table ${target} as ${table.query}`));
39728
+ tasks.add(Task.statement(`create table ${target}${this.tableOptions(table)} as ${table.query}`));
39729
+ this.createIndexes(table).forEach(stmt => tasks.add(Task.statement(stmt)));
38677
39730
  return tasks;
38678
39731
  }
38679
39732
  assertTasks(assertion, projectConfig) {
@@ -38710,6 +39763,42 @@ class MysqlExecutionSql {
38710
39763
  const tail = updates.length > 0 ? ` on duplicate key update ${updates}` : "";
38711
39764
  return `insert into ${target} (${backticked.join(", ")}) select ${backticked.join(", ")} from (${query}) as insertions${tail}`;
38712
39765
  }
39766
+ tableOptions(table) {
39767
+ const opts = table.mysql;
39768
+ if (!opts) {
39769
+ return "";
39770
+ }
39771
+ let suffix = "";
39772
+ if (opts.engine) {
39773
+ suffix += ` engine=${opts.engine}`;
39774
+ }
39775
+ if (opts.charset) {
39776
+ suffix += ` default charset=${opts.charset}`;
39777
+ }
39778
+ if (opts.collation) {
39779
+ suffix += ` collate=${opts.collation}`;
39780
+ }
39781
+ return suffix;
39782
+ }
39783
+ createIndexes(table) {
39784
+ var _a;
39785
+ const indexes = (_a = table.mysql) === null || _a === void 0 ? void 0 : _a.indexes;
39786
+ if (!indexes || indexes.length === 0) {
39787
+ return [];
39788
+ }
39789
+ const target = this.resolveTarget(table.target);
39790
+ return indexes.map(index => {
39791
+ const unique = index.unique ? "unique " : "";
39792
+ const cols = (index.columns || []).map(c => `\`${c}\``).join(", ");
39793
+ const name = index.name || this.defaultIndexName(table.target.name, index.columns, !!index.unique);
39794
+ return `alter table ${target} add ${unique}index \`${name}\` (${cols})`;
39795
+ });
39796
+ }
39797
+ defaultIndexName(tableName, columns, unique) {
39798
+ const parts = [tableName, ...(columns || [])].filter(Boolean);
39799
+ const suffix = unique ? "_key" : "_idx";
39800
+ return `${parts.join("_")}${suffix}`.slice(0, 63);
39801
+ }
38713
39802
  }
38714
39803
 
38715
39804
  class PostgresExecutionSql {
@@ -39110,7 +40199,7 @@ function collectEvaluationQueries(queryOrAction, concatenate, queryModifier = (q
39110
40199
  .filter(validationQuery => !!validationQuery.query);
39111
40200
  }
39112
40201
 
39113
- const version = "1.5.0";
40202
+ const version = "1.7.0";
39114
40203
  const dataformVersion = "3.0.59";
39115
40204
 
39116
40205
  async function build(compiledGraph, runConfig, dbadapter) {
@@ -39437,6 +40526,7 @@ async function test$1(dbadapter, timeoutMs = 10000) {
39437
40526
 
39438
40527
  const gitIgnoreContents = `
39439
40528
  ${CREDENTIALS_FILENAME}
40529
+ .df-credentials*.json
39440
40530
  node_modules/
39441
40531
  `;
39442
40532
  function postgresCredentialsTemplate(warehouse) {
@@ -40312,6 +41402,46 @@ function normalizeRow(row) {
40312
41402
  return newRow;
40313
41403
  }
40314
41404
 
41405
+ function resolveEnvironment(projectDir, envName) {
41406
+ const settings = readConfigFromWorkflowSettings(projectDir);
41407
+ const environments = (settings === null || settings === void 0 ? void 0 : settings.environments) || {};
41408
+ const env = environments[envName];
41409
+ if (!env) {
41410
+ const available = Object.keys(environments);
41411
+ throw new Error(`Environment "${envName}" not found. ` +
41412
+ (available.length
41413
+ ? `Available environments: ${available.join(", ")}.`
41414
+ : `No environments defined in workflow_settings.yaml.`));
41415
+ }
41416
+ const configOverride = {};
41417
+ if (env.schemaSuffix) {
41418
+ configOverride.schemaSuffix = env.schemaSuffix;
41419
+ }
41420
+ if (env.vars && Object.keys(env.vars).length > 0) {
41421
+ configOverride.vars = env.vars;
41422
+ }
41423
+ if (env.defaultDatabase) {
41424
+ configOverride.defaultDatabase = env.defaultDatabase;
41425
+ }
41426
+ if (env.defaultLocation) {
41427
+ configOverride.defaultLocation = env.defaultLocation;
41428
+ }
41429
+ return { configOverride, credentials: env.credentials || undefined };
41430
+ }
41431
+ function mergeProjectConfigOverride(envOverride, cliOverride) {
41432
+ const merged = Object.assign(Object.assign({}, envOverride), cliOverride);
41433
+ if (envOverride.vars || cliOverride.vars) {
41434
+ merged.vars = Object.assign(Object.assign({}, envOverride.vars), cliOverride.vars);
41435
+ }
41436
+ return merged;
41437
+ }
41438
+ function resolveCredentials(envCredentials, cliCredentials, defaultFilename) {
41439
+ if (cliCredentials && cliCredentials !== defaultFilename) {
41440
+ return cliCredentials;
41441
+ }
41442
+ return envCredentials || defaultFilename;
41443
+ }
41444
+
40315
41445
  function parsePostgresEvalError(_query, error) {
40316
41446
  return sqlanvil.QueryEvaluationError.create({
40317
41447
  message: (error === null || error === void 0 ? void 0 : error.message) ? String(error.message) : String(error)
@@ -40879,6 +42009,44 @@ function convertFieldType$1(type) {
40879
42009
  return sqlanvil.Field.Primitive.UNKNOWN;
40880
42010
  }
40881
42011
  }
42012
+ function escapeMysqlString(s) {
42013
+ return s.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
42014
+ }
42015
+ function reconstructColumnDef(col) {
42016
+ const extra = (col.extra || "").toLowerCase();
42017
+ const notNull = col.isNullable === "NO";
42018
+ if (extra.includes("generated") && col.generationExpression) {
42019
+ const storage = extra.includes("stored") ? "STORED" : "VIRTUAL";
42020
+ return `${col.columnType} GENERATED ALWAYS AS (${col.generationExpression}) ${storage}${notNull ? " NOT NULL" : ""}`;
42021
+ }
42022
+ let def = col.columnType;
42023
+ if (col.collationName) {
42024
+ def += ` COLLATE ${col.collationName}`;
42025
+ }
42026
+ def += notNull ? " NOT NULL" : " NULL";
42027
+ def += defaultClause(col, extra);
42028
+ if (extra.includes("on update current_timestamp")) {
42029
+ def += " ON UPDATE CURRENT_TIMESTAMP";
42030
+ }
42031
+ if (extra.includes("auto_increment")) {
42032
+ def += " AUTO_INCREMENT";
42033
+ }
42034
+ return def;
42035
+ }
42036
+ function defaultClause(col, extra) {
42037
+ if (extra.includes("default_generated")) {
42038
+ const d = col.columnDefault || "";
42039
+ return /^current_timestamp/i.test(d) ? ` DEFAULT ${d}` : ` DEFAULT (${d})`;
42040
+ }
42041
+ if (col.columnDefault === null || col.columnDefault === undefined) {
42042
+ return "";
42043
+ }
42044
+ const d = col.columnDefault;
42045
+ if (d.toUpperCase() === "NULL" || /^-?\d+(\.\d+)?$/.test(d)) {
42046
+ return ` DEFAULT ${d}`;
42047
+ }
42048
+ return ` DEFAULT '${escapeMysqlString(d)}'`;
42049
+ }
40882
42050
 
40883
42051
  const INTERNAL_SCHEMAS$1 = new Set([
40884
42052
  "information_schema",
@@ -41001,12 +42169,12 @@ class MySqlDbAdapter {
41001
42169
  })));
41002
42170
  }
41003
42171
  async table(target) {
41004
- var _a;
42172
+ var _a, _b, _c;
41005
42173
  const params = [target.schema, target.name];
41006
42174
  const [tableResults, columnResults] = await Promise.all([
41007
- this.execute(`select table_type from information_schema.tables
42175
+ this.execute(`select table_type, table_comment from information_schema.tables
41008
42176
  where table_schema = ? and table_name = ?`, { params, includeQueryInError: true }),
41009
- this.execute(`select column_name, data_type, ordinal_position
42177
+ this.execute(`select column_name, data_type, ordinal_position, column_comment
41010
42178
  from information_schema.columns
41011
42179
  where table_schema = ? and table_name = ?
41012
42180
  order by ordinal_position`, { params, includeQueryInError: true })
@@ -41015,14 +42183,18 @@ class MySqlDbAdapter {
41015
42183
  return null;
41016
42184
  }
41017
42185
  const tableType = String((_a = tableResults.rows[0].table_type) !== null && _a !== void 0 ? _a : tableResults.rows[0].TABLE_TYPE).toUpperCase();
42186
+ const tableComment = String((_c = (_b = tableResults.rows[0].table_comment) !== null && _b !== void 0 ? _b : tableResults.rows[0].TABLE_COMMENT) !== null && _c !== void 0 ? _c : "");
41018
42187
  return sqlanvil.TableMetadata.create({
41019
42188
  target,
41020
42189
  type: tableType === "VIEW" ? sqlanvil.TableMetadata.Type.VIEW : sqlanvil.TableMetadata.Type.TABLE,
42190
+ description: tableComment || undefined,
41021
42191
  fields: columnResults.rows.map(row => {
41022
- var _a, _b;
42192
+ var _a, _b, _c, _d;
42193
+ const comment = String((_b = (_a = row.column_comment) !== null && _a !== void 0 ? _a : row.COLUMN_COMMENT) !== null && _b !== void 0 ? _b : "");
41023
42194
  return sqlanvil.Field.create({
41024
- name: ((_a = row.column_name) !== null && _a !== void 0 ? _a : row.COLUMN_NAME),
41025
- primitive: convertFieldType$1(((_b = row.data_type) !== null && _b !== void 0 ? _b : row.DATA_TYPE))
42195
+ name: ((_c = row.column_name) !== null && _c !== void 0 ? _c : row.COLUMN_NAME),
42196
+ primitive: convertFieldType$1(((_d = row.data_type) !== null && _d !== void 0 ? _d : row.DATA_TYPE)),
42197
+ description: comment || undefined
41026
42198
  });
41027
42199
  })
41028
42200
  });
@@ -41050,8 +42222,57 @@ class MySqlDbAdapter {
41050
42222
  includeQueryInError: true
41051
42223
  });
41052
42224
  }
41053
- async setMetadata(_action) {
41054
- return;
42225
+ async setMetadata(action) {
42226
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
42227
+ const { target, actionDescriptor } = action;
42228
+ const actualMetadata = await this.table(target);
42229
+ if (!actualMetadata) {
42230
+ return;
42231
+ }
42232
+ if (actualMetadata.type === sqlanvil.TableMetadata.Type.VIEW) {
42233
+ return;
42234
+ }
42235
+ const resolved = `\`${target.schema}\`.\`${target.name}\``;
42236
+ if (actionDescriptor === null || actionDescriptor === void 0 ? void 0 : actionDescriptor.description) {
42237
+ await this.execute(`alter table ${resolved} comment = '${escapeMysqlString(actionDescriptor.description)}'`, { includeQueryInError: true });
42238
+ }
42239
+ const columnComments = ((actionDescriptor === null || actionDescriptor === void 0 ? void 0 : actionDescriptor.columns) || []).filter(column => {
42240
+ var _a;
42241
+ return ((_a = column.path) === null || _a === void 0 ? void 0 : _a.length) === 1 &&
42242
+ column.description != null &&
42243
+ actualMetadata.fields.some(f => f.name === column.path[0]);
42244
+ });
42245
+ if (columnComments.length === 0) {
42246
+ return;
42247
+ }
42248
+ const defResult = await this.execute(`select column_name, column_type, is_nullable, column_default, extra,
42249
+ collation_name, generation_expression
42250
+ from information_schema.columns
42251
+ where table_schema = ? and table_name = ?`, { params: [target.schema, target.name], includeQueryInError: true });
42252
+ const defByName = new Map();
42253
+ defResult.rows.forEach(row => { var _a; return defByName.set(String((_a = row.column_name) !== null && _a !== void 0 ? _a : row.COLUMN_NAME), row); });
42254
+ for (const column of columnComments) {
42255
+ const name = column.path[0];
42256
+ const row = defByName.get(name);
42257
+ if (!row) {
42258
+ continue;
42259
+ }
42260
+ const def = reconstructColumnDef({
42261
+ columnType: String((_a = row.column_type) !== null && _a !== void 0 ? _a : row.COLUMN_TYPE),
42262
+ isNullable: String((_b = row.is_nullable) !== null && _b !== void 0 ? _b : row.IS_NULLABLE),
42263
+ columnDefault: ((_d = (_c = row.column_default) !== null && _c !== void 0 ? _c : row.COLUMN_DEFAULT) !== null && _d !== void 0 ? _d : null) === null
42264
+ ? null
42265
+ : String((_e = row.column_default) !== null && _e !== void 0 ? _e : row.COLUMN_DEFAULT),
42266
+ extra: String((_g = (_f = row.extra) !== null && _f !== void 0 ? _f : row.EXTRA) !== null && _g !== void 0 ? _g : ""),
42267
+ collationName: ((_j = (_h = row.collation_name) !== null && _h !== void 0 ? _h : row.COLLATION_NAME) !== null && _j !== void 0 ? _j : null) === null
42268
+ ? null
42269
+ : String((_k = row.collation_name) !== null && _k !== void 0 ? _k : row.COLLATION_NAME),
42270
+ generationExpression: ((_m = (_l = row.generation_expression) !== null && _l !== void 0 ? _l : row.GENERATION_EXPRESSION) !== null && _m !== void 0 ? _m : null) === null
42271
+ ? null
42272
+ : String((_o = row.generation_expression) !== null && _o !== void 0 ? _o : row.GENERATION_EXPRESSION)
42273
+ });
42274
+ await this.execute(`alter table ${resolved} modify column \`${name}\` ${def} comment '${escapeMysqlString(column.description)}'`, { includeQueryInError: true });
42275
+ }
41055
42276
  }
41056
42277
  async close() {
41057
42278
  await this.queryExecutor.close();
@@ -42850,6 +44071,21 @@ const actionRetryLimitName = "action-retry-limit";
42850
44071
  function getCredentialsPath(projectDir, credentialsPath) {
42851
44072
  return actuallyResolve(projectDir, credentialsPath);
42852
44073
  }
44074
+ function projectConfigOverrideWithEnvironment(projectDir, argv) {
44075
+ const cliOverride = ProjectConfigOptions.constructProjectConfigOverride(argv);
44076
+ if (!argv[ProjectConfigOptions.environment.name]) {
44077
+ return cliOverride;
44078
+ }
44079
+ const { configOverride } = resolveEnvironment(projectDir, argv[ProjectConfigOptions.environment.name]);
44080
+ return mergeProjectConfigOverride(configOverride, cliOverride);
44081
+ }
44082
+ function credentialsPathWithEnvironment(projectDir, argv) {
44083
+ const envCredentials = argv[ProjectConfigOptions.environment.name]
44084
+ ? resolveEnvironment(projectDir, argv[ProjectConfigOptions.environment.name]).credentials
44085
+ : undefined;
44086
+ const chosen = resolveCredentials(envCredentials, argv[credentialsOption.name], CREDENTIALS_FILENAME);
44087
+ return getCredentialsPath(projectDir, chosen);
44088
+ }
42853
44089
  function runCli() {
42854
44090
  const builtYargs = createYargsCli({
42855
44091
  commands: [
@@ -43007,7 +44243,7 @@ function runCli() {
43007
44243
  }
43008
44244
  const compiledGraph = await compile({
43009
44245
  projectDir,
43010
- projectConfigOverride: ProjectConfigOptions.constructProjectConfigOverride(argv),
44246
+ projectConfigOverride: projectConfigOverrideWithEnvironment(projectDir, argv),
43011
44247
  timeoutMillis: argv[timeoutOption.name] || undefined,
43012
44248
  verbose: argv[verboseOptionName] || false
43013
44249
  });
@@ -43088,7 +44324,7 @@ function runCli() {
43088
44324
  }
43089
44325
  const compiledGraph = await compile({
43090
44326
  projectDir: argv[projectDirMustExistOption.name],
43091
- projectConfigOverride: ProjectConfigOptions.constructProjectConfigOverride(argv),
44327
+ projectConfigOverride: projectConfigOverrideWithEnvironment(argv[projectDirMustExistOption.name], argv),
43092
44328
  timeoutMillis: argv[timeoutOption.name] || undefined
43093
44329
  });
43094
44330
  if (compiledGraphHasErrors(compiledGraph)) {
@@ -43099,7 +44335,7 @@ function runCli() {
43099
44335
  printSuccess("Compiled successfully.\n");
43100
44336
  }
43101
44337
  const warehouse = compiledGraph.projectConfig.warehouse || "bigquery";
43102
- const readCredentials = read(getCredentialsPath(argv[projectDirOption.name], argv[credentialsOption.name]), warehouse);
44338
+ const readCredentials = read(credentialsPathWithEnvironment(argv[projectDirMustExistOption.name], argv), warehouse);
43103
44339
  if (!compiledGraph.tests.length) {
43104
44340
  printError("No unit tests found.");
43105
44341
  return 1;
@@ -43171,7 +44407,7 @@ function runCli() {
43171
44407
  }
43172
44408
  const compiledGraph = await compile({
43173
44409
  projectDir: argv[projectDirOption.name],
43174
- projectConfigOverride: ProjectConfigOptions.constructProjectConfigOverride(argv),
44410
+ projectConfigOverride: projectConfigOverrideWithEnvironment(argv[projectDirOption.name], argv),
43175
44411
  timeoutMillis: argv[timeoutOption.name] || undefined
43176
44412
  });
43177
44413
  if (compiledGraphHasErrors(compiledGraph)) {
@@ -43182,7 +44418,7 @@ function runCli() {
43182
44418
  printSuccess("Compiled successfully.\n");
43183
44419
  }
43184
44420
  const warehouse = compiledGraph.projectConfig.warehouse || "bigquery";
43185
- const readCredentials = read(getCredentialsPath(argv[projectDirOption.name], argv[credentialsOption.name]), warehouse);
44421
+ const readCredentials = read(credentialsPathWithEnvironment(argv[projectDirOption.name], argv), warehouse);
43186
44422
  let dbadapter;
43187
44423
  if (warehouse.toLowerCase() === "supabase") {
43188
44424
  dbadapter = await SupabaseDbAdapter.create(readCredentials);
@@ -43237,7 +44473,7 @@ function runCli() {
43237
44473
  print("No actions to run.\n");
43238
44474
  return 0;
43239
44475
  }
43240
- const connectionCredentials = readConnections(getCredentialsPath(argv[projectDirOption.name], argv[credentialsOption.name]));
44476
+ const connectionCredentials = readConnections(credentialsPathWithEnvironment(argv[projectDirOption.name], argv));
43241
44477
  assertConnectionCredentialsAvailable(executionGraph, connectionCredentials);
43242
44478
  if (argv[dryRunOptionName]) {
43243
44479
  print("Dry running (no changes to the warehouse will be applied)...");
@@ -43481,6 +44717,11 @@ ProjectConfigOptions.defaultReservation = option("default-reservation", {
43481
44717
  "workflow_settings.yaml is used. If neither is set, default BigQuery behavior applies.",
43482
44718
  type: "string"
43483
44719
  });
44720
+ ProjectConfigOptions.environment = option("environment", {
44721
+ describe: "Named environment from workflow_settings.yaml `environments:` to load (its schemaSuffix, " +
44722
+ "vars, defaultDatabase/location, and credentials file). Explicit flags override the environment.",
44723
+ type: "string"
44724
+ });
43484
44725
  ProjectConfigOptions.allYargsOptions = [
43485
44726
  ProjectConfigOptions.defaultDatabase,
43486
44727
  ProjectConfigOptions.defaultSchema,
@@ -43491,7 +44732,8 @@ ProjectConfigOptions.allYargsOptions = [
43491
44732
  ProjectConfigOptions.schemaSuffix,
43492
44733
  ProjectConfigOptions.tablePrefix,
43493
44734
  ProjectConfigOptions.disableAssertions,
43494
- ProjectConfigOptions.defaultReservation
44735
+ ProjectConfigOptions.defaultReservation,
44736
+ ProjectConfigOptions.environment
43495
44737
  ];
43496
44738
 
43497
44739
  runCli();