-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from andrewwippler/feature/frontend-uploads
Fix migrations for live DB
- Loading branch information
Showing
4 changed files
with
38 additions
and
18 deletions.
There are no files selected for viewing
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
26 changes: 26 additions & 0 deletions
26
api/database/migrations/1722051530896_delete_api_tokens.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,26 @@ | ||
import { BaseSchema } from '@adonisjs/lucid/schema' | ||
|
||
export default class extends BaseSchema { | ||
protected tableName = 'api_tokens' | ||
|
||
async up() { | ||
this.schema.dropTable(this.tableName) | ||
} | ||
|
||
async down() { | ||
this.schema.createTable(this.tableName, (table) => { | ||
table.increments('id').primary() | ||
table.integer('user_id').unsigned().index('user_id') | ||
table.foreign('user_id').references('users.id').onDelete('cascade') | ||
table.string('name').notNullable() | ||
table.string('type').notNullable() | ||
table.string('token', 64).notNullable().unique() | ||
|
||
/** | ||
* Uses timestampz for PostgreSQL and DATETIME2 for MSSQL | ||
*/ | ||
table.timestamp('expires_at', { useTz: true }).nullable() | ||
table.timestamp('created_at', { useTz: true }).notNullable() | ||
}) | ||
} | ||
} |
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