-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
1 parent
b2175cd
commit 47d245a
Showing
21 changed files
with
115 additions
and
1 deletion.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions
16
database/migrations/1736423244968-create-failed_jobs-table.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,16 @@ | ||
import type { Database } from '@stacksjs/database' | ||
import { sql } from '@stacksjs/database' | ||
|
||
export async function up(db: Database<any>) { | ||
await db.schema | ||
.createTable('failed_jobs') | ||
.addColumn('id', 'integer', col => col.primaryKey().autoIncrement()) | ||
.addColumn('connection', 'varchar(100)', col => col.notNull()) | ||
.addColumn('queue', 'varchar(255)', col => col.notNull()) | ||
.addColumn('payload', 'varchar(255)', col => col.notNull()) | ||
.addColumn('exception', 'varchar(255)', col => col.notNull()) | ||
.addColumn('failed_at', 'date') | ||
.addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) | ||
.addColumn('updated_at', 'timestamp') | ||
.execute() | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import type { Model } from '@stacksjs/types' | ||
import { faker } from '@stacksjs/faker' | ||
import { schema } from '@stacksjs/validation' | ||
|
||
export default { | ||
name: 'FailedJob', | ||
table: 'failed_jobs', | ||
primaryKey: 'id', | ||
autoIncrement: true, | ||
|
||
traits: { | ||
useTimestamps: true, | ||
}, | ||
|
||
attributes: { | ||
connection: { | ||
required: true, | ||
fillable: true, | ||
validation: { | ||
rule: schema.string().maxLength(100), | ||
message: { | ||
maxLength: 'Connection must have a maximum of 100 characters', | ||
string: 'Connection must be a string', | ||
}, | ||
}, | ||
factory: () => 'default', | ||
}, | ||
|
||
queue: { | ||
required: true, | ||
fillable: true, | ||
validation: { | ||
rule: schema.string().maxLength(255), | ||
message: { | ||
maxLength: 'Queue must have a maximum of 255 characters', | ||
}, | ||
}, | ||
factory: () => 'default', | ||
}, | ||
|
||
payload: { | ||
required: true, | ||
fillable: true, | ||
validation: { | ||
rule: schema.string(), | ||
}, | ||
factory: () => faker.lorem.sentence(), | ||
}, | ||
|
||
exception: { | ||
required: true, | ||
fillable: true, | ||
validation: { | ||
rule: schema.string(), | ||
}, | ||
factory: () => faker.lorem.sentence(), | ||
}, | ||
|
||
failed_at: { | ||
fillable: true, | ||
validation: { | ||
rule: schema.date(), | ||
}, | ||
factory: () => '2024-12-23 13:32:19', | ||
}, | ||
}, | ||
} satisfies Model |