drizzle-kit 0.9.27 → 0.9.28
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/index.js +13 -9
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -163752,17 +163752,21 @@ var applySnapshotsDiff = async (json1, json2, tablesResolver, columnsResolver) =
|
|
|
163752
163752
|
};
|
|
163753
163753
|
|
|
163754
163754
|
// src/cli/commands/migrate.tsx
|
|
163755
|
-
var prepareAndMigrate = async (
|
|
163756
|
-
const drizzleConfig =
|
|
163755
|
+
var prepareAndMigrate = async () => {
|
|
163756
|
+
const drizzleConfig = js_yaml_default.load(import_fs4.default.readFileSync("drizzle.config.yml", { encoding: "utf-8" }));
|
|
163757
163757
|
const migrationRootFolder = drizzleConfig.migrationRootFolder || "drizzle";
|
|
163758
163758
|
const dataFolder = drizzleConfig.dataFolder;
|
|
163759
|
-
|
|
163760
|
-
|
|
163761
|
-
|
|
163762
|
-
|
|
163763
|
-
|
|
163764
|
-
|
|
163765
|
-
|
|
163759
|
+
try {
|
|
163760
|
+
const { prev, cur } = await prepareJsonSnapshots(migrationRootFolder, dataFolder);
|
|
163761
|
+
const sql = await prepareSQL(prev, cur);
|
|
163762
|
+
const folderName = prepareSnapshotFolderName();
|
|
163763
|
+
const migrationFolderPath = `./${migrationRootFolder}/${folderName}`;
|
|
163764
|
+
import_fs4.default.mkdirSync(migrationFolderPath);
|
|
163765
|
+
import_fs4.default.writeFileSync(`${migrationFolderPath}/snapshot.json`, JSON.stringify(cur, null, 2));
|
|
163766
|
+
import_fs4.default.writeFileSync(`${migrationFolderPath}/migration.sql`, sql);
|
|
163767
|
+
} catch (e) {
|
|
163768
|
+
console.error(e);
|
|
163769
|
+
}
|
|
163766
163770
|
};
|
|
163767
163771
|
var prepareJsonSnapshots = async (migrationRootFolder, dataFolder) => {
|
|
163768
163772
|
return await task("Preparing data schema json snapshot", async ({ setTitle }) => {
|