drizzle-kit 0.23.1 → 0.23.2-3d4e79a
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 +0 -0
 - package/{payload.d.mts → api.d.mts} +518 -518
 - package/{payload.d.ts → api.d.ts} +518 -518
 - package/{payload.js → api.js} +24822 -25132
 - package/{payload.mjs → api.mjs} +24820 -25131
 - package/bin.cjs +12172 -12570
 - package/index.d.mts +14 -20
 - package/index.d.ts +14 -20
 - package/package.json +115 -115
 - package/utils.js +20 -18
 - package/utils.mjs +20 -26
 - package/readme.md +0 -79
 
    
        package/utils.mjs
    CHANGED
    
    | 
         @@ -32,9 +32,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge 
     | 
|
| 
       32 
32 
     | 
    
         
             
              mod
         
     | 
| 
       33 
33 
     | 
    
         
             
            ));
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
     | 
    
         
            -
            // node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js
         
     | 
| 
      
 35 
     | 
    
         
            +
            // ../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js
         
     | 
| 
       36 
36 
     | 
    
         
             
            var require_readline = __commonJS({
         
     | 
| 
       37 
     | 
    
         
            -
              "node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js"(exports) {
         
     | 
| 
      
 37 
     | 
    
         
            +
              "../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js"(exports) {
         
     | 
| 
       38 
38 
     | 
    
         
             
                "use strict";
         
     | 
| 
       39 
39 
     | 
    
         
             
                Object.defineProperty(exports, "__esModule", { value: true });
         
     | 
| 
       40 
40 
     | 
    
         
             
                exports.prepareReadLine = void 0;
         
     | 
| 
         @@ -57,9 +57,9 @@ var require_readline = __commonJS({ 
     | 
|
| 
       57 
57 
     | 
    
         
             
              }
         
     | 
| 
       58 
58 
     | 
    
         
             
            });
         
     | 
| 
       59 
59 
     | 
    
         | 
| 
       60 
     | 
    
         
            -
            // node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
         
     | 
| 
      
 60 
     | 
    
         
            +
            // ../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
         
     | 
| 
       61 
61 
     | 
    
         
             
            var require_src = __commonJS({
         
     | 
| 
       62 
     | 
    
         
            -
              "node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module) {
         
     | 
| 
      
 62 
     | 
    
         
            +
              "../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module) {
         
     | 
| 
       63 
63 
     | 
    
         
             
                "use strict";
         
     | 
| 
       64 
64 
     | 
    
         
             
                var ESC = "\x1B";
         
     | 
| 
       65 
65 
     | 
    
         
             
                var CSI = `${ESC}[`;
         
     | 
| 
         @@ -118,9 +118,9 @@ var require_src = __commonJS({ 
     | 
|
| 
       118 
118 
     | 
    
         
             
              }
         
     | 
| 
       119 
119 
     | 
    
         
             
            });
         
     | 
| 
       120 
120 
     | 
    
         | 
| 
       121 
     | 
    
         
            -
            // node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/utils.js
         
     | 
| 
      
 121 
     | 
    
         
            +
            // ../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/utils.js
         
     | 
| 
       122 
122 
     | 
    
         
             
            var require_utils = __commonJS({
         
     | 
| 
       123 
     | 
    
         
            -
              "node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/utils.js"(exports) {
         
     | 
| 
      
 123 
     | 
    
         
            +
              "../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/utils.js"(exports) {
         
     | 
| 
       124 
124 
     | 
    
         
             
                "use strict";
         
     | 
| 
       125 
125 
     | 
    
         
             
                Object.defineProperty(exports, "__esModule", { value: true });
         
     | 
| 
       126 
126 
     | 
    
         
             
                exports.clear = void 0;
         
     | 
| 
         @@ -148,9 +148,9 @@ var require_utils = __commonJS({ 
     | 
|
| 
       148 
148 
     | 
    
         
             
              }
         
     | 
| 
       149 
149 
     | 
    
         
             
            });
         
     | 
| 
       150 
150 
     | 
    
         | 
| 
       151 
     | 
    
         
            -
            // node_modules/.pnpm/lodash.throttle@4.1.1/node_modules/lodash.throttle/index.js
         
     | 
| 
      
 151 
     | 
    
         
            +
            // ../node_modules/.pnpm/lodash.throttle@4.1.1/node_modules/lodash.throttle/index.js
         
     | 
| 
       152 
152 
     | 
    
         
             
            var require_lodash = __commonJS({
         
     | 
| 
       153 
     | 
    
         
            -
              "node_modules/.pnpm/lodash.throttle@4.1.1/node_modules/lodash.throttle/index.js"(exports, module) {
         
     | 
| 
      
 153 
     | 
    
         
            +
              "../node_modules/.pnpm/lodash.throttle@4.1.1/node_modules/lodash.throttle/index.js"(exports, module) {
         
     | 
| 
       154 
154 
     | 
    
         
             
                var FUNC_ERROR_TEXT = "Expected a function";
         
     | 
| 
       155 
155 
     | 
    
         
             
                var NAN = 0 / 0;
         
     | 
| 
       156 
156 
     | 
    
         
             
                var symbolTag = "[object Symbol]";
         
     | 
| 
         @@ -296,9 +296,9 @@ var require_lodash = __commonJS({ 
     | 
|
| 
       296 
296 
     | 
    
         
             
              }
         
     | 
| 
       297 
297 
     | 
    
         
             
            });
         
     | 
| 
       298 
298 
     | 
    
         | 
| 
       299 
     | 
    
         
            -
            // node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/index.js
         
     | 
| 
      
 299 
     | 
    
         
            +
            // ../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/index.js
         
     | 
| 
       300 
300 
     | 
    
         
             
            var require_hanji = __commonJS({
         
     | 
| 
       301 
     | 
    
         
            -
              "node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/index.js"(exports) {
         
     | 
| 
      
 301 
     | 
    
         
            +
              "../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/index.js"(exports) {
         
     | 
| 
       302 
302 
     | 
    
         
             
                "use strict";
         
     | 
| 
       303 
303 
     | 
    
         
             
                var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
         
     | 
| 
       304 
304 
     | 
    
         
             
                  function adopt(value) {
         
     | 
| 
         @@ -562,16 +562,7 @@ var require_hanji = __commonJS({ 
     | 
|
| 
       562 
562 
     | 
    
         
             
              }
         
     | 
| 
       563 
563 
     | 
    
         
             
            });
         
     | 
| 
       564 
564 
     | 
    
         | 
| 
       565 
     | 
    
         
            -
            //  
     | 
| 
       566 
     | 
    
         
            -
            import {
         
     | 
| 
       567 
     | 
    
         
            -
              existsSync,
         
     | 
| 
       568 
     | 
    
         
            -
              mkdirSync,
         
     | 
| 
       569 
     | 
    
         
            -
              readdirSync,
         
     | 
| 
       570 
     | 
    
         
            -
              readFileSync,
         
     | 
| 
       571 
     | 
    
         
            -
              writeFileSync
         
     | 
| 
       572 
     | 
    
         
            -
            } from "fs";
         
     | 
| 
       573 
     | 
    
         
            -
             
     | 
| 
       574 
     | 
    
         
            -
            // node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
         
     | 
| 
      
 565 
     | 
    
         
            +
            // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
         
     | 
| 
       575 
566 
     | 
    
         
             
            var ANSI_BACKGROUND_OFFSET = 10;
         
     | 
| 
       576 
567 
     | 
    
         
             
            var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
         
     | 
| 
       577 
568 
     | 
    
         
             
            var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
         
     | 
| 
         @@ -757,7 +748,7 @@ function assembleStyles() { 
     | 
|
| 
       757 
748 
     | 
    
         
             
            var ansiStyles = assembleStyles();
         
     | 
| 
       758 
749 
     | 
    
         
             
            var ansi_styles_default = ansiStyles;
         
     | 
| 
       759 
750 
     | 
    
         | 
| 
       760 
     | 
    
         
            -
            // node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
         
     | 
| 
      
 751 
     | 
    
         
            +
            // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
         
     | 
| 
       761 
752 
     | 
    
         
             
            import process2 from "node:process";
         
     | 
| 
       762 
753 
     | 
    
         
             
            import os from "node:os";
         
     | 
| 
       763 
754 
     | 
    
         
             
            import tty from "node:tty";
         
     | 
| 
         @@ -883,7 +874,7 @@ var supportsColor = { 
     | 
|
| 
       883 
874 
     | 
    
         
             
            };
         
     | 
| 
       884 
875 
     | 
    
         
             
            var supports_color_default = supportsColor;
         
     | 
| 
       885 
876 
     | 
    
         | 
| 
       886 
     | 
    
         
            -
            // node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
         
     | 
| 
      
 877 
     | 
    
         
            +
            // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
         
     | 
| 
       887 
878 
     | 
    
         
             
            function stringReplaceAll(string, substring, replacer) {
         
     | 
| 
       888 
879 
     | 
    
         
             
              let index4 = string.indexOf(substring);
         
     | 
| 
       889 
880 
     | 
    
         
             
              if (index4 === -1) {
         
     | 
| 
         @@ -913,7 +904,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index4) { 
     | 
|
| 
       913 
904 
     | 
    
         
             
              return returnValue;
         
     | 
| 
       914 
905 
     | 
    
         
             
            }
         
     | 
| 
       915 
906 
     | 
    
         | 
| 
       916 
     | 
    
         
            -
            // node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
         
     | 
| 
      
 907 
     | 
    
         
            +
            // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
         
     | 
| 
       917 
908 
     | 
    
         
             
            var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
         
     | 
| 
       918 
909 
     | 
    
         
             
            var GENERATOR = Symbol("GENERATOR");
         
     | 
| 
       919 
910 
     | 
    
         
             
            var STYLER = Symbol("STYLER");
         
     | 
| 
         @@ -1060,6 +1051,11 @@ var chalk = createChalk(); 
     | 
|
| 
       1060 
1051 
     | 
    
         
             
            var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
         
     | 
| 
       1061 
1052 
     | 
    
         
             
            var source_default = chalk;
         
     | 
| 
       1062 
1053 
     | 
    
         | 
| 
      
 1054 
     | 
    
         
            +
            // src/utils.ts
         
     | 
| 
      
 1055 
     | 
    
         
            +
            import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "fs";
         
     | 
| 
      
 1056 
     | 
    
         
            +
            import { join } from "path";
         
     | 
| 
      
 1057 
     | 
    
         
            +
            import { parse } from "url";
         
     | 
| 
      
 1058 
     | 
    
         
            +
             
     | 
| 
       1063 
1059 
     | 
    
         
             
            // src/cli/views.ts
         
     | 
| 
       1064 
1060 
     | 
    
         
             
            var import_hanji = __toESM(require_hanji());
         
     | 
| 
       1065 
1061 
     | 
    
         
             
            var info = (msg, greyMsg = "") => {
         
     | 
| 
         @@ -1073,7 +1069,7 @@ function assertUnreachable(x) { 
     | 
|
| 
       1073 
1069 
     | 
    
         
             
              throw new Error("Didn't expect to get here");
         
     | 
| 
       1074 
1070 
     | 
    
         
             
            }
         
     | 
| 
       1075 
1071 
     | 
    
         | 
| 
       1076 
     | 
    
         
            -
            // node_modules/.pnpm/zod@3.23. 
     | 
| 
      
 1072 
     | 
    
         
            +
            // ../node_modules/.pnpm/zod@3.23.7/node_modules/zod/lib/index.mjs
         
     | 
| 
       1077 
1073 
     | 
    
         
             
            var util;
         
     | 
| 
       1078 
1074 
     | 
    
         
             
            (function(util2) {
         
     | 
| 
       1079 
1075 
     | 
    
         
             
              util2.assertEqual = (val) => val;
         
     | 
| 
         @@ -5533,8 +5529,6 @@ var sqliteSchemaV5 = schemaV52; 
     | 
|
| 
       5533 
5529 
     | 
    
         
             
            var backwardCompatibleSqliteSchema = unionType([sqliteSchemaV5, schema2]);
         
     | 
| 
       5534 
5530 
     | 
    
         | 
| 
       5535 
5531 
     | 
    
         
             
            // src/utils.ts
         
     | 
| 
       5536 
     | 
    
         
            -
            import { join } from "path";
         
     | 
| 
       5537 
     | 
    
         
            -
            import { parse } from "url";
         
     | 
| 
       5538 
5532 
     | 
    
         
             
            var copy = (it) => {
         
     | 
| 
       5539 
5533 
     | 
    
         
             
              return JSON.parse(JSON.stringify(it));
         
     | 
| 
       5540 
5534 
     | 
    
         
             
            };
         
     | 
    
        package/readme.md
    DELETED
    
    | 
         @@ -1,79 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            ## Drizzle Kit
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            DrizzleKit - is a CLI migrator tool for DrizzleORM. It is probably one and only tool that lets you completely automatically generate SQL migrations and covers ~95% of the common cases like deletions and renames by prompting user input.
         
     | 
| 
       4 
     | 
    
         
            -
            <https://github.com/drizzle-team/drizzle-kit-mirror> - is a mirror repository for issues.
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
            ## Documentation
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
            Check the full documenation on [the website](https://orm.drizzle.team/kit-docs/overview)
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
            ### How it works
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
            `drizzle-kit` will traverse `schema folder` or `schema file`, generate schema snapshot and compare it to the previous version, if there's one.
         
     | 
| 
       13 
     | 
    
         
            -
             Based on the difference it will generate all needed SQL migrations and if there are any `automatically unresolvable` cases like `renames` it will prompt user for input.
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
            For schema file:
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
            ```typescript
         
     | 
| 
       18 
     | 
    
         
            -
            // ./src/db/schema.ts
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
            import { integer, pgTable, serial, text, varchar } from "drizzle-orm/pg-core";
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
            const users = pgTable("users", {
         
     | 
| 
       23 
     | 
    
         
            -
                id: serial("id").primaryKey(),
         
     | 
| 
       24 
     | 
    
         
            -
                fullName: varchar("full_name", { length: 256 }),
         
     | 
| 
       25 
     | 
    
         
            -
              }, (table) => ({
         
     | 
| 
       26 
     | 
    
         
            -
                nameIdx: index("name_idx", table.fullName),
         
     | 
| 
       27 
     | 
    
         
            -
              })
         
     | 
| 
       28 
     | 
    
         
            -
            );
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
            export const authOtp = pgTable("auth_otp", {
         
     | 
| 
       31 
     | 
    
         
            -
              id: serial("id").primaryKey(),
         
     | 
| 
       32 
     | 
    
         
            -
              phone: varchar("phone", { length: 256 }),
         
     | 
| 
       33 
     | 
    
         
            -
              userId: integer("user_id").references(() => users.id),
         
     | 
| 
       34 
     | 
    
         
            -
            });
         
     | 
| 
       35 
     | 
    
         
            -
            ```
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
            It will generate:
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
            ```SQL
         
     | 
| 
       40 
     | 
    
         
            -
            CREATE TABLE IF NOT EXISTS auth_otp (
         
     | 
| 
       41 
     | 
    
         
            -
             "id" SERIAL PRIMARY KEY,
         
     | 
| 
       42 
     | 
    
         
            -
             "phone" character varying(256),
         
     | 
| 
       43 
     | 
    
         
            -
             "user_id" INT
         
     | 
| 
       44 
     | 
    
         
            -
            );
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
            CREATE TABLE IF NOT EXISTS users (
         
     | 
| 
       47 
     | 
    
         
            -
             "id" SERIAL PRIMARY KEY,
         
     | 
| 
       48 
     | 
    
         
            -
             "full_name" character varying(256)
         
     | 
| 
       49 
     | 
    
         
            -
            );
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
            DO $$ BEGIN
         
     | 
| 
       52 
     | 
    
         
            -
             ALTER TABLE auth_otp ADD CONSTRAINT auth_otp_user_id_fkey FOREIGN KEY ("user_id") REFERENCES users(id);
         
     | 
| 
       53 
     | 
    
         
            -
            EXCEPTION
         
     | 
| 
       54 
     | 
    
         
            -
             WHEN duplicate_object THEN null;
         
     | 
| 
       55 
     | 
    
         
            -
            END $$;
         
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
            CREATE INDEX IF NOT EXISTS users_full_name_index ON users (full_name);
         
     | 
| 
       58 
     | 
    
         
            -
            ```
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
            ### Installation & configuration
         
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
            ```shell
         
     | 
| 
       63 
     | 
    
         
            -
            npm install -D drizzle-kit
         
     | 
| 
       64 
     | 
    
         
            -
            ```
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
            Running with CLI options
         
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
            ```jsonc
         
     | 
| 
       69 
     | 
    
         
            -
            // package.json
         
     | 
| 
       70 
     | 
    
         
            -
            {
         
     | 
| 
       71 
     | 
    
         
            -
             "scripts": {
         
     | 
| 
       72 
     | 
    
         
            -
              "generate": "drizzle-kit generate:pg --out migrations-folder --schema src/db/schema.ts"
         
     | 
| 
       73 
     | 
    
         
            -
             }
         
     | 
| 
       74 
     | 
    
         
            -
            }
         
     | 
| 
       75 
     | 
    
         
            -
            ```
         
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
            ```shell
         
     | 
| 
       78 
     | 
    
         
            -
            npm run generate
         
     | 
| 
       79 
     | 
    
         
            -
            ```
         
     |