index.ts — astro Source File
Architecture documentation for index.ts, a typescript file in the astro codebase. 9 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR d792b779_355c_47a7_c602_04c8b8882820["index.ts"] eda9bb18_dc7e_2d22_8ac4_4f2697d51221["./consts.js"] d792b779_355c_47a7_c602_04c8b8882820 --> eda9bb18_dc7e_2d22_8ac4_4f2697d51221 2ccf236c_b2f8_cdff_d260_11fea0f1fc10["../db-client/libsql-node.js"] d792b779_355c_47a7_c602_04c8b8882820 --> 2ccf236c_b2f8_cdff_d260_11fea0f1fc10 97fa73a6_cf67_73a5_b60d_d52bfb00c7d8["./core/types.js"] d792b779_355c_47a7_c602_04c8b8882820 --> 97fa73a6_cf67_73a5_b60d_d52bfb00c7d8 6ae6435e_1314_7d59_4826_25e9a2ada03f["./utils.js"] d792b779_355c_47a7_c602_04c8b8882820 --> 6ae6435e_1314_7d59_4826_25e9a2ada03f 631e111e_d645_5a8b_135d_7579935eb52e["../../migration-queries.js"] d792b779_355c_47a7_c602_04c8b8882820 --> 631e111e_d645_5a8b_135d_7579935eb52e f16d8c76_2866_6150_bd14_0347b59abfe9["astro"] d792b779_355c_47a7_c602_04c8b8882820 --> f16d8c76_2866_6150_bd14_0347b59abfe9 5e5ea2f4_4ff1_f558_0bea_0b3ded79b0ac["drizzle-orm"] d792b779_355c_47a7_c602_04c8b8882820 --> 5e5ea2f4_4ff1_f558_0bea_0b3ded79b0ac 340b0f28_45a9_98e5_fc8e_01e5b2ac8446["prompts"] d792b779_355c_47a7_c602_04c8b8882820 --> 340b0f28_45a9_98e5_fc8e_01e5b2ac8446 efd0f150_4239_ba62_fbb9_bcf24bd27236["yargs-parser"] d792b779_355c_47a7_c602_04c8b8882820 --> efd0f150_4239_ba62_fbb9_bcf24bd27236 style d792b779_355c_47a7_c602_04c8b8882820 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { AstroConfig } from 'astro';
import { sql } from 'drizzle-orm';
import prompts from 'prompts';
import type { Arguments } from 'yargs-parser';
import { MIGRATION_VERSION } from '../../../consts.js';
import { createClient } from '../../../db-client/libsql-node.js';
import type { DBConfig, DBSnapshot } from '../../../types.js';
import {
getRemoteDatabaseInfo,
type RemoteDatabaseInfo,
resolveDbAppToken,
} from '../../../utils.js';
import {
createCurrentSnapshot,
createEmptySnapshot,
formatDataLossMessage,
getMigrationQueries,
getProductionCurrentSnapshot,
} from '../../migration-queries.js';
export async function cmd({
dbConfig,
flags,
}: {
astroConfig: AstroConfig;
dbConfig: DBConfig;
flags: Arguments;
}) {
const isDryRun = flags.dryRun;
const isForceReset = flags.forceReset;
const dbInfo = getRemoteDatabaseInfo();
const appToken = resolveDbAppToken(flags, dbInfo.token);
const productionSnapshot = await getProductionCurrentSnapshot({ ...dbInfo, token: appToken });
const currentSnapshot = createCurrentSnapshot(dbConfig);
const isFromScratch = !productionSnapshot;
const { queries: migrationQueries, confirmations } = await getMigrationQueries({
oldSnapshot: isFromScratch ? createEmptySnapshot() : productionSnapshot,
newSnapshot: currentSnapshot,
reset: isForceReset,
});
// // push the database schema
if (migrationQueries.length === 0) {
console.log('Database schema is up to date.');
} else {
console.log(`Database schema is out of date.`);
}
if (isForceReset) {
const { begin } = await prompts({
type: 'confirm',
name: 'begin',
message: `Reset your database? All of your data will be erased and your schema created from scratch.`,
initial: false,
});
if (!begin) {
console.log('Canceled.');
process.exit(0);
}
// ... (78 more lines)
Domain
Subdomains
Functions
Types
Dependencies
- ../../migration-queries.js
- ../db-client/libsql-node.js
- ./consts.js
- ./core/types.js
- ./utils.js
- astro
- drizzle-orm
- prompts
- yargs-parser
Source
Frequently Asked Questions
What does index.ts do?
index.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, CoreMiddleware subdomain.
What functions are defined in index.ts?
index.ts defines 3 function(s): cmd, pushSchema, pushToDb.
What does index.ts depend on?
index.ts imports 9 module(s): ../../migration-queries.js, ../db-client/libsql-node.js, ./consts.js, ./core/types.js, ./utils.js, astro, drizzle-orm, prompts, and 1 more.
Where is index.ts in the architecture?
index.ts is located at packages/db/src/core/cli/commands/push/index.ts (domain: CoreAstro, subdomain: CoreMiddleware, directory: packages/db/src/core/cli/commands/push).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free