Skip to content

Commit 5c37889

Browse files
🦋 Add dbo.Photo table missed in existing migrations.
1 parent c49b0a3 commit 5c37889

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { type Knex } from 'knex';
2+
3+
export async function up(knex: Knex): Promise<void> {
4+
const tableExists = await knex.schema.hasTable('dbo.Photo');
5+
6+
if (!tableExists) {
7+
// Best guess based on existing code as I don't have a copy of the database
8+
await knex.schema.withSchema('dbo').createTable('Photo', (table) => {
9+
table.increments('RowId').primary();
10+
table.integer('CommunityId').nullable();
11+
table.integer('PlaceId').nullable();
12+
table.binary('File').nullable();
13+
table.binary('ThumbFile').nullable();
14+
table.string('FeatureName').nullable();
15+
table.string('OriginalFileName').nullable();
16+
table.string('Address').nullable();
17+
table.string('Caption').nullable();
18+
19+
table.foreign('CommunityId').references('Community.Id');
20+
table.foreign('PlaceId').references('Place.Id');
21+
});
22+
}
23+
}
24+
25+
export async function down(knex: Knex): Promise<void> {
26+
await knex.schema.withSchema('dbo').dropTableIfExists('Photo');
27+
}

0 commit comments

Comments
 (0)