diff --git a/src/__tests__/_/api-handlers/config.ts b/src/__tests__/_/api-handlers/config.ts
index 8feac6bcf..34ccb68c3 100644
--- a/src/__tests__/_/api-handlers/config.ts
+++ b/src/__tests__/_/api-handlers/config.ts
@@ -61,7 +61,6 @@ const ENTITY_VIEWS = (entity: string): ITableTab[] => [
const CONFIG_VALUES = {
system_settings: {
- forceIntrospection: true,
tokenValidityDurationInDays: 5,
},
site_settings: {
diff --git a/src/__tests__/admin/settings/system.spec.tsx b/src/__tests__/admin/settings/system.spec.tsx
index d33930e4f..1d0b483ef 100644
--- a/src/__tests__/admin/settings/system.spec.tsx
+++ b/src/__tests__/admin/settings/system.spec.tsx
@@ -27,7 +27,6 @@ describe("pages/admin/settings/system", () => {
screen.getByLabelText("Token Validity Duration In Days")
).toHaveValue(5);
});
- expect(screen.getByLabelText("Force Introspection")).toBeChecked();
});
it("should update system settings successfully", async () => {
@@ -42,8 +41,6 @@ describe("pages/admin/settings/system", () => {
"9"
);
- userEvent.click(screen.getByLabelText("Force Introspection"));
-
await userEvent.click(
screen.getByRole("button", { name: "Save System Settings" })
);
@@ -64,6 +61,5 @@ describe("pages/admin/settings/system", () => {
screen.getByLabelText("Token Validity Duration In Days")
).toHaveValue(59);
});
- expect(screen.getByLabelText("Force Introspection")).not.toBeChecked();
});
});
diff --git a/src/__tests__/api/_test-utils/_app-config.ts b/src/__tests__/api/_test-utils/_app-config.ts
index 3702d3943..94b2b98fa 100644
--- a/src/__tests__/api/_test-utils/_app-config.ts
+++ b/src/__tests__/api/_test-utils/_app-config.ts
@@ -7,7 +7,6 @@ const TEST_APP_CONFIG: Partial> = {
plural: "Base Model Plural",
},
system_settings: {
- forceIntrospection: false,
tokenValidityDurationInDays: 1,
},
};
diff --git a/src/backend/schema/__tests__/schema.service.spec.ts b/src/backend/schema/__tests__/schema.service.spec.ts
index 04f8d60bf..0b4d84f1d 100644
--- a/src/backend/schema/__tests__/schema.service.spec.ts
+++ b/src/backend/schema/__tests__/schema.service.spec.ts
@@ -1,11 +1,7 @@
import { credentialsApiService } from "backend/integrations-configurations";
import { createConfigDomainPersistenceService } from "backend/lib/config-persistence";
import { IDBSchema } from "shared/types/db";
-import { configurationApiService } from "backend/configuration/configuration.service";
-import {
- setupAppConfigTestData,
- setupCredentialsTestData,
-} from "__tests__/api/_test-utils";
+import { setupCredentialsTestData } from "__tests__/api/_test-utils";
import { getDbConnection } from "backend/lib/connection/db";
import { SchemasApiService } from "../schema.service";
@@ -45,15 +41,14 @@ const setupTestDatabaseData = async (modified: boolean) => {
};
describe("SchemaService", () => {
+ const OLD_ENV = process.env;
const schemaPersistenceService =
createConfigDomainPersistenceService("schema");
beforeAll(async () => {
- await setupAppConfigTestData({
- system_settings: {
- forceIntrospection: false,
- },
- });
+ // @ts-ignore
+ process.env.NODE_ENV = "development";
+
await setupCredentialsTestData({
DATABASE___dataSourceType:
"aad0f7e776963ae66b7459222d54871433f8e119ab9a9712d4e82e8cbb77246e47a750a773c0ea316c110a1d3f2ee16c2509906fb89f1c4b039d09f139b1d7eacc26908c25137c46f269cfb13f63221da2f1631bf4f59cbe14cc18cbfb8993098bd7e2d865f20717",
@@ -66,11 +61,19 @@ describe("SchemaService", () => {
await schemaPersistenceService.resetState("name", []);
});
+ beforeEach(() => {
+ jest.resetModules();
+ process.env = { ...OLD_ENV };
+ });
+
+ afterEach(() => {
+ process.env = OLD_ENV;
+ });
+
it("should introspect database correctly when there is no schema data", async () => {
const schemasService = new SchemasApiService(
schemaPersistenceService,
- credentialsApiService,
- configurationApiService
+ credentialsApiService
);
expect(JSON.parse(JSON.stringify(await schemasService.getDBSchema())))
@@ -163,11 +166,10 @@ describe("SchemaService", () => {
`);
});
- it("should not introspect database when schema data already exists when `forceIntrospection` is `false`", async () => {
+ it("should not introspect database when schema data already exists when not on PROD", async () => {
const schemasService = new SchemasApiService(
schemaPersistenceService,
- credentialsApiService,
- configurationApiService
+ credentialsApiService
);
await setupTestDatabaseData(true);
@@ -175,19 +177,15 @@ describe("SchemaService", () => {
expect(await schemasService.getDBSchema()).toHaveLength(2);
});
- it("should introspect database when schema data already exists when `forceIntrospection` is `true`", async () => {
+ it("should introspect database when schema data already exists when on PROD", async () => {
+ // @ts-ignore
+ process.env.NODE_ENV = "production";
+
const schemasService = new SchemasApiService(
schemaPersistenceService,
- credentialsApiService,
- configurationApiService
+ credentialsApiService
);
- await setupAppConfigTestData({
- system_settings: {
- forceIntrospection: true,
- },
- });
-
await setupTestDatabaseData(true);
expect(await schemasService.getDBSchema()).toHaveLength(3);
diff --git a/src/backend/schema/schema.service.ts b/src/backend/schema/schema.service.ts
index 58ee5f0a2..137132cf6 100644
--- a/src/backend/schema/schema.service.ts
+++ b/src/backend/schema/schema.service.ts
@@ -1,8 +1,4 @@
import { introspect, Entity } from "@dashpress/bacteria";
-import {
- ConfigurationApiService,
- configurationApiService,
-} from "backend/configuration/configuration.service";
import {
CredentialsApiService,
credentialsApiService,
@@ -22,8 +18,7 @@ export class SchemasApiService implements IApplicationService {
constructor(
private _schemaConfigDataPersistenceService: AbstractConfigDataPersistenceService,
- private _credentialsService: CredentialsApiService,
- private _configurationService: ConfigurationApiService
+ private _credentialsService: CredentialsApiService
) {}
async bootstrap() {
@@ -50,9 +45,7 @@ export class SchemasApiService implements IApplicationService {
}
private async initDBSchema() {
- if (
- await this._configurationService.getSystemSettings("forceIntrospection")
- ) {
+ if (process.env.NODE_ENV === "production") {
return await this.doIntrospection();
}
@@ -159,6 +152,5 @@ const schemaPersistenceService =
export const schemasApiService = new SchemasApiService(
schemaPersistenceService,
- credentialsApiService,
- configurationApiService
+ credentialsApiService
);
diff --git a/src/frontend/docs/system-settings.tsx b/src/frontend/docs/system-settings.tsx
index 175fc753c..879c999f6 100644
--- a/src/frontend/docs/system-settings.tsx
+++ b/src/frontend/docs/system-settings.tsx
@@ -13,16 +13,6 @@ export function SystemSettingsDocumentation(props: IDocumentationRootProps) {
that invalidation duration.
- Force Introspection
-
- We introspect your database every time the application runs and save the
- schema. This behavior is good for 99% of production use cases as you
- want the schema to be up to date whenever you run the application so
- that DashPress shows you the latest database changes. In case you do not
- want your schema up to date for any reason then you can always toggle
- this off here.
-
-
);
diff --git a/src/frontend/views/settings/System/Form.tsx b/src/frontend/views/settings/System/Form.tsx
index b41242ed1..90160c230 100644
--- a/src/frontend/views/settings/System/Form.tsx
+++ b/src/frontend/views/settings/System/Form.tsx
@@ -24,10 +24,6 @@ export function SystemSettingsForm({
},
],
},
- forceIntrospection: {
- type: "boolean",
- validations: [],
- },
}}
/>
);
diff --git a/src/frontend/views/settings/System/index.tsx b/src/frontend/views/settings/System/index.tsx
index 26164dc3d..70e09b9c9 100644
--- a/src/frontend/views/settings/System/index.tsx
+++ b/src/frontend/views/settings/System/index.tsx
@@ -53,11 +53,7 @@ export function SystemSettings() {
- }
+ loader={}
>
{
diff --git a/src/shared/configurations/system.ts b/src/shared/configurations/system.ts
index a844002b7..6d497ff76 100644
--- a/src/shared/configurations/system.ts
+++ b/src/shared/configurations/system.ts
@@ -4,7 +4,6 @@ import {
} from "./portal";
export type IBaseSystemSettings = {
- forceIntrospection: boolean;
tokenValidityDurationInDays: number;
};
@@ -12,6 +11,5 @@ export type ISystemSettings = IBaseSystemSettings & IPortalSystemSettings;
export const DEFAULT_SYSTEM_SETTINGS: ISystemSettings = {
...PORTAL_DEFAULT_SYSTEM_SETTINGS,
- forceIntrospection: process.env.NODE_ENV === "production",
tokenValidityDurationInDays: 14,
};