mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Update environment variables and documentation: set DB_CONNECTION_URI in .env.migration.example, remove FAQ section from contributing docs, and refine pull request guidelines.
This commit is contained in:
@@ -8,7 +8,7 @@ Suppose you're interested in implementing a new feature in Infisical's backend,
|
||||
If your feature involves a change in the database, you need to first address this by generating the necessary database schemas.
|
||||
|
||||
1. If you're adding a new table, update the `TableName` enum in `/src/db/schemas/models.ts` to include the new table name.
|
||||
2. Create a new migration file by running `npm run migration:new` and give it a relevant name, such as `feature-x`.
|
||||
2. Create a new migration file by going to the `/backend` folder and running `npm run migration:new` and give it a relevant name, such as `feature-x`.
|
||||
3. Navigate to `/src/db/migrations/<timestamp>_<feature-x>.ts`.
|
||||
4. Modify both the `up` and `down` functions to create or alter Postgres fields on migration up and to revert these changes on migration down, ensuring idempotency as outlined [here](https://github.com/graphile/migrate/blob/main/docs/idempotent-examples.md).
|
||||
|
||||
@@ -16,10 +16,11 @@ If your feature involves a change in the database, you need to first address thi
|
||||
|
||||
While typically you would need to manually write TS types for Knex type-sense, we have automated this process:
|
||||
|
||||
1. Start the server.
|
||||
2. Run `npm run migration:latest` to apply all database changes.
|
||||
3. Execute `npm run generate:schema` to automatically generate types and schemas using [zod](https://github.com/colinhacks/zod) in the `/src/db/schemas` folder.
|
||||
4. Update the barrel export in `schema/index` and include the new tables in `/src/@types/knex.d.ts` to enable type-sensing in Knex.js.
|
||||
1. If you haven't done it yet, create a new `.env.migration` file at the root of the Infisical directory then copy the contents of the file linked [here](https://github.com/Infisical/infisical/blob/main/.env.migration.example)
|
||||
2. Start the server.
|
||||
3. Go to the `/backend` folder and run `npm run migration:latest-dev` to apply all database changes.
|
||||
4. Execute `npm run generate:schema` to automatically generate types and schemas using [zod](https://github.com/colinhacks/zod) in the `/src/db/schemas` folder.
|
||||
5. Update the barrel export in `schema/index` and include the new tables in `/src/@types/knex.d.ts` to enable type-sensing in Knex.js.
|
||||
|
||||
## Business Logic
|
||||
|
||||
|
||||
Reference in New Issue
Block a user