-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
benbot
committed
Oct 25, 2023
1 parent
709c6ed
commit e9de120
Showing
4 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
apps/server/migrations/20231018135155_addAgentReleaseTable.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Knex } from "knex"; | ||
|
||
|
||
export async function up(knex: Knex): Promise<void> { | ||
return knex.schema.createTable('AgentReleases', function(table) { | ||
table.increments('id').primary(); // Creates a regular id field as primary key, auto-increments | ||
table.integer('agent_id').unsigned().notNullable(); // Field referencing 'agents' table | ||
table.foreign('agent_id').references('id').inTable('agents'); // Establishes the foreign key relationship | ||
table.string('version', 255).notNullable(); // String field for version tag | ||
table.timestamp('createdAt').defaultTo(knex.fn.now()); // 'createdAt' field with the current timestamp | ||
}); | ||
} | ||
|
||
|
||
export async function down(knex: Knex): Promise<void> { | ||
return knex.schema.dropTable('AgentReleases'); | ||
} | ||
|
12 changes: 12 additions & 0 deletions
12
apps/server/migrations/20231025125524_addFrozenFlagToAgents.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Knex } from "knex"; | ||
|
||
|
||
export async function up(knex: Knex): Promise<void> { | ||
Check warning on line 4 in apps/server/migrations/20231025125524_addFrozenFlagToAgents.ts GitHub Actions / ESLint
|
||
table.boolean('frozen').defaultTo(false).notNullable(); | ||
} | ||
|
||
|
||
export async function down(knex: Knex): Promise<void> { | ||
Check warning on line 9 in apps/server/migrations/20231025125524_addFrozenFlagToAgents.ts GitHub Actions / ESLint
|
||
table.dropColumn('frozen'); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters