import { IS_SANDBOX, checkEnvIsTruthy } from '@environment';
import { migrate } from 'drizzle-orm/aws-data-api/pg/migrator';
import { resetDatabaseFn } from 'src/debug/resetDatabase';
import logger from 'src/logger';
import { Resource } from 'sst';
export const handler = async ({
skipReset,
db,
}: {
skipReset?: boolean;
db: sst.aws.Postgres;
}) => {
if (
!skipReset &&
checkEnvIsTruthy(Resource.DB_SHOULD_RESET.value) &&
IS_SANDBOX
) {
await resetDatabaseFn();
}
await migrate(db, { migrationsFolder: 'packages/functions/drizzle' });
};
import { IS_SANDBOX, checkEnvIsTruthy } from '@environment';
import { migrate } from 'drizzle-orm/aws-data-api/pg/migrator';
import { resetDatabaseFn } from 'src/debug/resetDatabase';
import logger from 'src/logger';
import { Resource } from 'sst';
export const handler = async ({
skipReset,
db,
}: {
skipReset?: boolean;
db: sst.aws.Postgres;
}) => {
if (
!skipReset &&
checkEnvIsTruthy(Resource.DB_SHOULD_RESET.value) &&
IS_SANDBOX
) {
await resetDatabaseFn();
}
await migrate(db, { migrationsFolder: 'packages/functions/drizzle' });
};