qubu 0.6.0 → 0.6.1
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.
- package/README.md +112 -0
- package/dist/codegen.d.mts +1 -1
- package/dist/codegen.mjs +1 -1
- package/dist/{column-r1Y4ivwt.mjs → column-BzN8KFJa.mjs} +39 -2
- package/dist/{column-Da37jYSD.mjs → column-CFvSbil0.mjs} +1 -1
- package/dist/{complete-types-CY0KbzNw.d.mts → complete-types-CNMWBWap.d.mts} +1 -1
- package/dist/{constraints-YGyNPQ_z.mjs → constraints-DM_tarXc.mjs} +2 -2
- package/dist/core.d.mts +1 -1
- package/dist/core.mjs +2 -3
- package/dist/diagnostics-I9vVtXkc.mjs +40 -0
- package/dist/diff.d.mts +2 -2
- package/dist/expressions-BCjc08zw.mjs +129 -0
- package/dist/{index-B2rZf3-2.d.mts → index-CGui70hi.d.mts} +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +58 -15
- package/dist/introspection/mysql.d.mts +26 -0
- package/dist/introspection/mysql.mjs +1145 -0
- package/dist/introspection/postgres.d.mts +40 -0
- package/dist/introspection/postgres.mjs +1554 -0
- package/dist/introspection/sqlite.d.mts +15 -0
- package/dist/introspection/sqlite.mjs +986 -0
- package/dist/introspection.d.mts +3 -78
- package/dist/introspection.mjs +5 -3683
- package/dist/mysql.d.mts +1 -1
- package/dist/mysql.mjs +2 -2
- package/dist/{on-conflict-DZQ85f1t.mjs → on-conflict-CnaY5qso.mjs} +76 -4
- package/dist/postgres-Dey7QXPL.mjs +69 -0
- package/dist/postgres.d.mts +3 -3
- package/dist/postgres.mjs +3 -52
- package/dist/registry-oWDiqD7i.mjs +127 -0
- package/dist/{relational-CxnLCqZQ.mjs → relational-DSAJ-l58.mjs} +1 -2
- package/dist/schema.d.mts +1 -1
- package/dist/schema.mjs +7 -6
- package/dist/{serialize-BN07IK0v.mjs → serialize-CE-gw5_s.mjs} +3 -3
- package/dist/{serialize-CEIIlWhC.d.mts → serialize-OvXCLzjm.d.mts} +1 -1
- package/dist/snapshot/mysql.d.mts +2 -2
- package/dist/snapshot/mysql.mjs +28 -28
- package/dist/snapshot/postgres.d.mts +4 -4
- package/dist/snapshot/postgres.mjs +21 -21
- package/dist/snapshot/sqlite.d.mts +4 -4
- package/dist/snapshot/sqlite.mjs +27 -27
- package/dist/{snapshot-Xam8-q0j.mjs → snapshot-DgsOhf_8.mjs} +4 -42
- package/dist/snapshot.d.mts +4 -4
- package/dist/snapshot.mjs +1 -1
- package/dist/{source-SqrKWjFJ.mjs → source-BDuUXmAk.mjs} +2 -2
- package/dist/sqlite.d.mts +1 -1
- package/dist/sqlite.mjs +6 -6
- package/dist/{table-BwflqeAj.mjs → table-C1QGNe4P.mjs} +3 -3
- package/dist/{types-CTCqtFlS.d.mts → types-BEn0N_al.d.mts} +1 -1
- package/dist/{types-BIJsj2fJ.mjs → types-BLNRatG_.mjs} +2 -4
- package/dist/{types-C0VkiwpR.d.mts → types-DUe6eeI0.d.mts} +57 -28
- package/docs/guides/compose-queries.md +22 -0
- package/docs/guides/drizzle.md +11 -11
- package/docs/guides/mutations.md +89 -0
- package/docs/guides/valtio-sync.md +113 -0
- package/docs/migrations/index.md +50 -12
- package/docs/migrations/operations.md +20 -6
- package/docs/reference/supported-surface.md +17 -6
- package/docs/schema/code-generation.md +3 -2
- package/docs/schema/introspection.md +3 -2
- package/docs/sql-semantic-types.md +8 -0
- package/package.json +13 -1
- package/dist/registry-BRcUuazJ.mjs +0 -256
- package/dist/standard-DfcZEVOj.mjs +0 -12
- package/dist/value-D14I_XgL.mjs +0 -29
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { a as assertDialectCapability } from "./json-Db7XRD91.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { A as parenthesize, B as resultValueOf, C as makeExpression, E as markSchemaExpression, F as dateResultDecoder, I as decodeResultRow, L as jsonTextResultDecoder, M as ResultDecodingError, N as booleanResultDecoder, O as fragment, P as createResultShape, R as resultShapeValue, S as isSchemaExpression, T as markExpressionCategory, V as timestampResultDecoder, b as snakeCaseIdentifier, i as identifier, k as isFragment, l as value, o as asValue, t as createColumnReference, w as makeSchemaExpression, x as isExpression, y as resolveSqlNames, z as resultValue } from "./column-BzN8KFJa.mjs";
|
|
3
|
+
import { c as render, n as call, o as cast, r as schemaCall, t as createClause } from "./types-BLNRatG_.mjs";
|
|
3
4
|
import { n as queryValidationError, t as QueryValidationError } from "./errors-Dxv73YJu.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { i as value, t as asValue } from "./value-D14I_XgL.mjs";
|
|
7
|
-
import { a as isDistinctFrom, c as lt, d as notLike, f as expressionOperand, i as gte, l as lte, m as renderOperands, n as eq, o as isNotDistinctFrom, p as isNullOperand, r as gt, s as like, u as ne } from "./relational-CxnLCqZQ.mjs";
|
|
5
|
+
import { C as identityColumn, S as generatedColumn, _ as uuid, b as externalDefault, c as integer, d as nativeStorage, f as nullable, g as timestamp, h as text, i as column, l as json, m as portableStorage, n as binary, o as date, p as numeric, r as boolean, s as encodeColumnParameter, t as bigint, u as nativeColumn, x as externalGeneratedColumn } from "./column-CFvSbil0.mjs";
|
|
6
|
+
import { a as isDistinctFrom, c as lt, d as notLike, f as expressionOperand, i as gte, l as lte, m as renderOperands, n as eq, o as isNotDistinctFrom, p as isNullOperand, r as gt, s as like, u as ne } from "./relational-DSAJ-l58.mjs";
|
|
8
7
|
import { t as omit } from "./omit-OxV58AwX.mjs";
|
|
9
|
-
import { r as exposeColumns, t as createSource } from "./source-
|
|
10
|
-
import { n as alias, r as lateral, t as table } from "./table-
|
|
11
|
-
import { a as primaryKey, c as uniqueConstraint, i as foreignKey, n as catalogForeignKey, o as references, r as check, s as unique, t as catalogCheck, u as index } from "./constraints-
|
|
12
|
-
import {
|
|
8
|
+
import { r as exposeColumns, t as createSource } from "./source-BDuUXmAk.mjs";
|
|
9
|
+
import { n as alias, r as lateral, t as table } from "./table-C1QGNe4P.mjs";
|
|
10
|
+
import { a as primaryKey, c as uniqueConstraint, i as foreignKey, n as catalogForeignKey, o as references, r as check, s as unique, t as catalogCheck, u as index } from "./constraints-DM_tarXc.mjs";
|
|
11
|
+
import { c as unsafeSchemaSql } from "./expressions-BCjc08zw.mjs";
|
|
12
|
+
import { i as schema } from "./registry-oWDiqD7i.mjs";
|
|
13
13
|
//#region src/execution.ts
|
|
14
14
|
function qubu(adapter, options = {}) {
|
|
15
15
|
const observation = createObservation(options.hooks);
|
|
@@ -391,14 +391,14 @@ function max(expression) {
|
|
|
391
391
|
}
|
|
392
392
|
//#endregion
|
|
393
393
|
//#region src/expressions/functions/string.ts
|
|
394
|
-
function lower(
|
|
395
|
-
return schemaCall("LOWER",
|
|
394
|
+
function lower(input) {
|
|
395
|
+
return schemaCall("LOWER", input);
|
|
396
396
|
}
|
|
397
|
-
function upper(
|
|
398
|
-
return schemaCall("UPPER",
|
|
397
|
+
function upper(input) {
|
|
398
|
+
return schemaCall("UPPER", input);
|
|
399
399
|
}
|
|
400
|
-
function coalesce(...
|
|
401
|
-
return schemaCall("COALESCE", ...
|
|
400
|
+
function coalesce(first, ...rest) {
|
|
401
|
+
return schemaCall("COALESCE", first, ...rest);
|
|
402
402
|
}
|
|
403
403
|
function concat(...argumentsToConcat) {
|
|
404
404
|
return schemaCall("CONCAT", ...argumentsToConcat);
|
|
@@ -1165,6 +1165,7 @@ function validateMutationClauses(kind, clauses) {
|
|
|
1165
1165
|
let whereSeen = false;
|
|
1166
1166
|
let returningSeen = false;
|
|
1167
1167
|
let allowAllSeen = false;
|
|
1168
|
+
let updateFromSeen = false;
|
|
1168
1169
|
for (const clause of clauses) if (clause.clauseKind === "where") {
|
|
1169
1170
|
if (whereSeen) throw queryValidationError({
|
|
1170
1171
|
code: "duplicate-clause",
|
|
@@ -1192,6 +1193,15 @@ function validateMutationClauses(kind, clauses) {
|
|
|
1192
1193
|
hint: "Keep one allowAll() marker when the mutation is intentionally unrestricted."
|
|
1193
1194
|
});
|
|
1194
1195
|
allowAllSeen = true;
|
|
1196
|
+
} else if (clause.clauseKind === "update-from") {
|
|
1197
|
+
if (updateFromSeen) throw queryValidationError({
|
|
1198
|
+
code: "duplicate-clause",
|
|
1199
|
+
context: "mutation.update.clauses",
|
|
1200
|
+
path: ["clauses", "updateFrom"],
|
|
1201
|
+
message: "UPDATE accepts only one FROM clause",
|
|
1202
|
+
hint: "Pass every source to one updateFrom() call."
|
|
1203
|
+
});
|
|
1204
|
+
updateFromSeen = true;
|
|
1195
1205
|
}
|
|
1196
1206
|
if (!whereSeen && !allowAllSeen) throw queryValidationError({
|
|
1197
1207
|
code: "unsafe-mutation",
|
|
@@ -1201,6 +1211,15 @@ function validateMutationClauses(kind, clauses) {
|
|
|
1201
1211
|
hint: "Add where(...) to target rows, or add allowAll() to make the unrestricted intent explicit."
|
|
1202
1212
|
});
|
|
1203
1213
|
}
|
|
1214
|
+
function validateMutationWithClauses(kind, clauses) {
|
|
1215
|
+
if (clauses.filter((clause) => clause.clauseKind === "with").length > 1) throw queryValidationError({
|
|
1216
|
+
code: "duplicate-clause",
|
|
1217
|
+
context: `mutation.${kind.toLowerCase()}.clauses`,
|
|
1218
|
+
path: ["clauses", "with"],
|
|
1219
|
+
message: `${kind} accepts only one WITH clause`,
|
|
1220
|
+
hint: "Pass every CTE to one withCte() clause."
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1204
1223
|
//#endregion
|
|
1205
1224
|
//#region src/query/mutation/insert.ts
|
|
1206
1225
|
function values(...rows) {
|
|
@@ -1222,7 +1241,13 @@ function insertSelect(query, columns) {
|
|
|
1222
1241
|
function insertInto(table, source, ...clauses) {
|
|
1223
1242
|
validateInsert(table, source);
|
|
1224
1243
|
const insertClauses = clauses;
|
|
1244
|
+
validateMutationWithClauses("INSERT", insertClauses);
|
|
1245
|
+
const withClause = insertClauses.find((clause) => clause.clauseKind === "with");
|
|
1225
1246
|
return createMutation("insert", insertClauses.find((clause) => clause.clauseKind === "returning")?.row ?? {}, insertClauses.find((clause) => clause.clauseKind === "returning")?.resultShape ?? { fields: [] }, (context) => {
|
|
1247
|
+
if (withClause) {
|
|
1248
|
+
context.render(withClause);
|
|
1249
|
+
context.append(" ");
|
|
1250
|
+
}
|
|
1226
1251
|
context.append("INSERT INTO ");
|
|
1227
1252
|
context.render(table.reference);
|
|
1228
1253
|
if (source.insertKind === "values") {
|
|
@@ -1263,6 +1288,7 @@ function insertInto(table, source, ...clauses) {
|
|
|
1263
1288
|
context.renderRelation(source.query);
|
|
1264
1289
|
}
|
|
1265
1290
|
for (const clause of insertClauses) {
|
|
1291
|
+
if (clause.clauseKind === "with") continue;
|
|
1266
1292
|
context.append(" ");
|
|
1267
1293
|
context.render(clause);
|
|
1268
1294
|
}
|
|
@@ -1395,10 +1421,17 @@ function validateInsert(table, source) {
|
|
|
1395
1421
|
function update(table, assignments, ...clauses) {
|
|
1396
1422
|
const normalizedClauses = clauses;
|
|
1397
1423
|
validateMutationClauses("UPDATE", normalizedClauses);
|
|
1424
|
+
validateMutationWithClauses("UPDATE", normalizedClauses);
|
|
1398
1425
|
const entries = validateUpdate(table, assignments);
|
|
1399
1426
|
const whereClause = normalizedClauses.find((clause) => clause.clauseKind === "where");
|
|
1427
|
+
const withClause = normalizedClauses.find((clause) => clause.clauseKind === "with");
|
|
1428
|
+
const fromClause = normalizedClauses.find((clause) => clause.clauseKind === "update-from");
|
|
1400
1429
|
const returningClause = normalizedClauses.find((clause) => clause.clauseKind === "returning");
|
|
1401
1430
|
return createMutation("update", returningClause?.row ?? {}, returningClause?.resultShape ?? { fields: [] }, (context) => {
|
|
1431
|
+
if (withClause) {
|
|
1432
|
+
context.render(withClause);
|
|
1433
|
+
context.append(" ");
|
|
1434
|
+
}
|
|
1402
1435
|
context.append("UPDATE ");
|
|
1403
1436
|
context.render(table.reference);
|
|
1404
1437
|
context.append(" SET ");
|
|
@@ -1408,6 +1441,10 @@ function update(table, assignments, ...clauses) {
|
|
|
1408
1441
|
context.append(" = ");
|
|
1409
1442
|
renderAssignmentValue(context, value, table.definitions[columnName]);
|
|
1410
1443
|
});
|
|
1444
|
+
if (fromClause) {
|
|
1445
|
+
context.append(" ");
|
|
1446
|
+
context.render(fromClause);
|
|
1447
|
+
}
|
|
1411
1448
|
if (whereClause) {
|
|
1412
1449
|
context.append(" ");
|
|
1413
1450
|
context.render(whereClause);
|
|
@@ -1456,9 +1493,15 @@ function validateUpdate(table, assignments) {
|
|
|
1456
1493
|
function deleteFrom(table, ...clauses) {
|
|
1457
1494
|
const normalizedClauses = clauses;
|
|
1458
1495
|
validateMutationClauses("DELETE", normalizedClauses);
|
|
1496
|
+
validateMutationWithClauses("DELETE", normalizedClauses);
|
|
1459
1497
|
const whereClause = normalizedClauses.find((clause) => clause.clauseKind === "where");
|
|
1498
|
+
const withClause = normalizedClauses.find((clause) => clause.clauseKind === "with");
|
|
1460
1499
|
const returningClause = normalizedClauses.find((clause) => clause.clauseKind === "returning");
|
|
1461
1500
|
return createMutation("delete", returningClause?.row ?? {}, returningClause?.resultShape ?? { fields: [] }, (context) => {
|
|
1501
|
+
if (withClause) {
|
|
1502
|
+
context.render(withClause);
|
|
1503
|
+
context.append(" ");
|
|
1504
|
+
}
|
|
1462
1505
|
context.append("DELETE FROM ");
|
|
1463
1506
|
context.render(table.reference);
|
|
1464
1507
|
if (whereClause) {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { kt as CatalogConnection, st as IntrospectionCatalog, ut as IntrospectionOptions } from "../types-BEn0N_al.mjs";
|
|
2
|
+
//#region src/introspection/mysql.d.ts
|
|
3
|
+
declare const mysqlServerQuery = "SELECT VERSION() AS version, @@version_comment AS version_comment";
|
|
4
|
+
declare const mysqlTablesQuery = "\n SELECT TABLE_NAME AS table_name, TABLE_TYPE AS table_type,\n ENGINE AS engine, TABLE_COLLATION AS table_collation,\n CREATE_OPTIONS AS create_options, TABLE_COMMENT AS table_comment\n FROM INFORMATION_SCHEMA.TABLES\n WHERE TABLE_SCHEMA = ?\n ORDER BY TABLE_NAME\n";
|
|
5
|
+
declare const mysqlColumnsQuery = "\n SELECT TABLE_NAME AS table_name, COLUMN_NAME AS column_name,\n ORDINAL_POSITION AS ordinal_position, COLUMN_TYPE AS column_type,\n DATA_TYPE AS data_type,\n IS_NULLABLE AS is_nullable, COLUMN_DEFAULT AS column_default,\n EXTRA AS extra, GENERATION_EXPRESSION AS generation_expression,\n CHARACTER_SET_NAME AS character_set_name,\n COLLATION_NAME AS collation_name, COLUMN_COMMENT AS column_comment\n FROM INFORMATION_SCHEMA.COLUMNS\n WHERE TABLE_SCHEMA = ?\n ORDER BY TABLE_NAME, ORDINAL_POSITION\n";
|
|
6
|
+
declare const mysqlKeyUsageQuery = "\n SELECT kcu.TABLE_NAME AS table_name, kcu.CONSTRAINT_NAME AS constraint_name,\n tc.CONSTRAINT_TYPE AS constraint_type, tc.ENFORCED AS enforced,\n kcu.COLUMN_NAME AS column_name, kcu.ORDINAL_POSITION AS ordinal_position,\n kcu.REFERENCED_TABLE_NAME AS referenced_table_name,\n kcu.REFERENCED_COLUMN_NAME AS referenced_column_name,\n rc.UPDATE_RULE AS update_rule, rc.DELETE_RULE AS delete_rule,\n rc.MATCH_OPTION AS match_option\n FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE kcu\n JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc\n ON tc.CONSTRAINT_SCHEMA = kcu.CONSTRAINT_SCHEMA\n AND tc.TABLE_NAME = kcu.TABLE_NAME\n AND tc.CONSTRAINT_NAME = kcu.CONSTRAINT_NAME\n LEFT JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS rc\n ON rc.CONSTRAINT_SCHEMA = kcu.CONSTRAINT_SCHEMA\n AND rc.TABLE_NAME = kcu.TABLE_NAME\n AND rc.CONSTRAINT_NAME = kcu.CONSTRAINT_NAME\n WHERE kcu.CONSTRAINT_SCHEMA = ?\n ORDER BY kcu.TABLE_NAME, kcu.CONSTRAINT_NAME, kcu.ORDINAL_POSITION\n";
|
|
7
|
+
declare const mysqlChecksQuery = "\n SELECT tc.TABLE_NAME AS table_name, tc.CONSTRAINT_NAME AS constraint_name,\n tc.ENFORCED AS enforced, cc.CHECK_CLAUSE AS check_clause\n FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc\n JOIN INFORMATION_SCHEMA.CHECK_CONSTRAINTS cc\n ON cc.CONSTRAINT_SCHEMA = tc.CONSTRAINT_SCHEMA\n AND cc.CONSTRAINT_NAME = tc.CONSTRAINT_NAME\n WHERE tc.CONSTRAINT_SCHEMA = ? AND tc.CONSTRAINT_TYPE = 'CHECK'\n ORDER BY tc.TABLE_NAME, tc.CONSTRAINT_NAME\n";
|
|
8
|
+
declare const mysqlStatisticsQuery = "\n SELECT TABLE_NAME AS table_name, INDEX_NAME AS index_name,\n NON_UNIQUE AS non_unique, SEQ_IN_INDEX AS seq_in_index,\n COLUMN_NAME AS column_name, COLLATION AS collation,\n INDEX_TYPE AS index_type, EXPRESSION AS expression,\n SUB_PART AS sub_part, IS_VISIBLE AS is_visible,\n COMMENT AS comment, INDEX_COMMENT AS index_comment\n FROM INFORMATION_SCHEMA.STATISTICS\n WHERE TABLE_SCHEMA = ?\n ORDER BY TABLE_NAME, INDEX_NAME, SEQ_IN_INDEX\n";
|
|
9
|
+
/** View definitions and execution properties for the selected database. */
|
|
10
|
+
declare const mysqlViewsQuery = "\n SELECT TABLE_NAME AS table_name, VIEW_DEFINITION AS view_definition,\n CHECK_OPTION AS check_option, IS_UPDATABLE AS is_updatable,\n SECURITY_TYPE AS security_type, DEFINER AS definer\n FROM INFORMATION_SCHEMA.VIEWS\n WHERE TABLE_SCHEMA = ?\n ORDER BY TABLE_NAME\n";
|
|
11
|
+
/** Stored function and procedure declarations for the selected database. */
|
|
12
|
+
declare const mysqlRoutinesQuery = "\n SELECT ROUTINE_NAME AS routine_name, ROUTINE_TYPE AS routine_type,\n DATA_TYPE AS data_type, DTD_IDENTIFIER AS dtd_identifier,\n ROUTINE_BODY AS routine_body,\n ROUTINE_DEFINITION AS routine_definition,\n EXTERNAL_LANGUAGE AS external_language,\n SQL_DATA_ACCESS AS sql_data_access,\n IS_DETERMINISTIC AS is_deterministic,\n SECURITY_TYPE AS security_type, SQL_MODE AS sql_mode,\n ROUTINE_COMMENT AS routine_comment\n FROM INFORMATION_SCHEMA.ROUTINES\n WHERE ROUTINE_SCHEMA = ?\n ORDER BY ROUTINE_NAME, ROUTINE_TYPE\n";
|
|
13
|
+
/** Parameter rows, including the ordinal zero return row for functions. */
|
|
14
|
+
declare const mysqlRoutineParametersQuery = "\n SELECT SPECIFIC_NAME AS routine_name, ORDINAL_POSITION AS ordinal_position,\n PARAMETER_MODE AS parameter_mode, PARAMETER_NAME AS parameter_name,\n DATA_TYPE AS data_type, DTD_IDENTIFIER AS dtd_identifier\n FROM INFORMATION_SCHEMA.PARAMETERS\n WHERE SPECIFIC_SCHEMA = ?\n ORDER BY SPECIFIC_NAME, ORDINAL_POSITION\n";
|
|
15
|
+
/** Trigger bodies and their table/event metadata. */
|
|
16
|
+
declare const mysqlTriggersQuery = "\n SELECT TRIGGER_NAME AS trigger_name, EVENT_MANIPULATION AS event_manipulation,\n EVENT_OBJECT_TABLE AS table_name, ACTION_CONDITION AS action_condition,\n ACTION_STATEMENT AS action_statement,\n ACTION_ORIENTATION AS action_orientation,\n ACTION_TIMING AS action_timing, ACTION_ORDER AS action_order,\n DEFINER AS definer, SQL_MODE AS sql_mode\n FROM INFORMATION_SCHEMA.TRIGGERS\n WHERE TRIGGER_SCHEMA = ?\n ORDER BY TRIGGER_NAME, ACTION_ORDER\n";
|
|
17
|
+
/** Partition and subpartition declarations for tables in the selected database. */
|
|
18
|
+
declare const mysqlPartitionsQuery = "\n SELECT TABLE_NAME AS table_name, PARTITION_NAME AS partition_name,\n SUBPARTITION_NAME AS subpartition_name,\n PARTITION_ORDINAL_POSITION AS partition_ordinal_position,\n SUBPARTITION_ORDINAL_POSITION AS subpartition_ordinal_position,\n PARTITION_METHOD AS partition_method,\n SUBPARTITION_METHOD AS subpartition_method,\n PARTITION_EXPRESSION AS partition_expression,\n SUBPARTITION_EXPRESSION AS subpartition_expression,\n PARTITION_DESCRIPTION AS partition_description,\n PARTITION_COMMENT AS partition_comment,\n TABLESPACE_NAME AS tablespace_name\n FROM INFORMATION_SCHEMA.PARTITIONS\n WHERE TABLE_SCHEMA = ? AND PARTITION_NAME IS NOT NULL\n ORDER BY TABLE_NAME, PARTITION_ORDINAL_POSITION, SUBPARTITION_ORDINAL_POSITION\n";
|
|
19
|
+
/** Collations used by tables or columns in the selected database. */
|
|
20
|
+
declare const mysqlCollationsQuery = "\n SELECT c.COLLATION_NAME AS collation_name,\n c.CHARACTER_SET_NAME AS character_set_name,\n c.ID AS collation_id, c.IS_DEFAULT AS is_default,\n c.IS_COMPILED AS is_compiled, c.SORTLEN AS sort_length,\n c.PAD_ATTRIBUTE AS pad_attribute\n FROM INFORMATION_SCHEMA.COLLATIONS c\n JOIN (\n SELECT DISTINCT TABLE_COLLATION AS collation_name\n FROM INFORMATION_SCHEMA.TABLES\n WHERE TABLE_SCHEMA = ? AND TABLE_COLLATION IS NOT NULL\n UNION\n SELECT DISTINCT COLLATION_NAME AS collation_name\n FROM INFORMATION_SCHEMA.COLUMNS\n WHERE TABLE_SCHEMA = ? AND COLLATION_NAME IS NOT NULL\n ) used ON used.collation_name = c.COLLATION_NAME\n ORDER BY c.COLLATION_NAME\n";
|
|
21
|
+
/** Scheduled events are retained as opaque MySQL objects, not migration input. */
|
|
22
|
+
declare const mysqlEventsQuery = "\n SELECT EVENT_NAME AS event_name, EVENT_TYPE AS event_type,\n STATUS AS status, EVENT_DEFINITION AS event_definition,\n EVENT_BODY AS event_body, EXECUTE_AT AS execute_at,\n INTERVAL_VALUE AS interval_value, INTERVAL_FIELD AS interval_field,\n EVENT_COMMENT AS event_comment, DEFINER AS definer\n FROM INFORMATION_SCHEMA.EVENTS\n WHERE EVENT_SCHEMA = ?\n ORDER BY EVENT_NAME\n";
|
|
23
|
+
/** Read one MySQL database into the normalized catalog contract. */
|
|
24
|
+
declare function readCatalog(connection: CatalogConnection, options: IntrospectionOptions): Promise<IntrospectionCatalog>;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { mysqlChecksQuery, mysqlCollationsQuery, mysqlColumnsQuery, mysqlEventsQuery, mysqlKeyUsageQuery, mysqlPartitionsQuery, mysqlRoutineParametersQuery, mysqlRoutinesQuery, mysqlServerQuery, mysqlStatisticsQuery, mysqlTablesQuery, mysqlTriggersQuery, mysqlViewsQuery, readCatalog };
|