-
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
39ab427
commit 04000d5
Showing
5 changed files
with
78 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { DateTime } from 'luxon' | ||
import { BaseModel, belongsTo, BelongsTo, column } from '@ioc:Adonis/Lucid/Orm' | ||
import App from './App' | ||
|
||
export default class Release extends BaseModel { | ||
@column({ isPrimary: true }) | ||
public id: number | ||
|
||
@column() | ||
public appId: number | ||
|
||
@belongsTo(() => App) | ||
public author: BelongsTo<typeof App> | ||
|
||
@column() | ||
public commitSha: string | ||
|
||
@column() | ||
public downloadLink: string | ||
|
||
@column.dateTime({ autoCreate: true }) | ||
public createdAt: DateTime | ||
} |
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,20 @@ | ||
import BaseSchema from '@ioc:Adonis/Lucid/Schema' | ||
|
||
export default class extends BaseSchema { | ||
protected tableName = 'apps' | ||
|
||
public async up () { | ||
this.schema.alterTable(this.tableName, (table) => { | ||
table.dropColumns('image', 'releases') | ||
table.string('source', 300).nullable() | ||
}) | ||
} | ||
|
||
public async down () { | ||
this.schema.alterTable(this.tableName, (table) => { | ||
table.string('image', 300).nullable() | ||
table.string('releases', 300).nullable() | ||
table.dropColumn('source') | ||
}) | ||
} | ||
} |
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,25 @@ | ||
import BaseSchema from '@ioc:Adonis/Lucid/Schema' | ||
|
||
export default class extends BaseSchema { | ||
protected tableName = 'releases' | ||
|
||
public async up () { | ||
this.schema.createTable(this.tableName, (table) => { | ||
table.increments('id') | ||
|
||
|
||
table.integer('app_id') | ||
.references('apps.id') | ||
.onDelete('CASCADE') | ||
|
||
table.string('commit_sha', 40) | ||
table.string('download_link').nullable() | ||
|
||
table.timestamp('created_at', { useTz: true }) | ||
}) | ||
} | ||
|
||
public async down () { | ||
this.schema.dropTable(this.tableName) | ||
} | ||
} |