Skip to content

Commit

Permalink
fix(server): make owner_idpersonne not unique; order by owner_idpersonne
Browse files Browse the repository at this point in the history
  • Loading branch information
Falinor committed Jan 7, 2025
1 parent 2cff2c6 commit 87ffb9a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export async function up(knex: Knex): Promise<void> {
.inTable('owners')
.onUpdate('CASCADE')
.onDelete('CASCADE');
table.string('owner_idpersonne').notNullable().unique();
table.string('owner_idpersonne').notNullable();
});
}

Expand Down
2 changes: 1 addition & 1 deletion server/src/repositories/departmentalOwnersRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface DepartmentalOwnerDBO {
function stream(): ReadableStream<DepartmentalOwnerDBO> {
const query = DepartmentalOwners()
.select(`${departmentalOwnersTable}.*`)
.orderBy('owner_id')
.orderBy('owner_idpersonne')
.stream();

return Readable.toWeb(query);
Expand Down
13 changes: 9 additions & 4 deletions server/src/scripts/import-unified-owners/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import createImportUnifiedOwnersCommand from '~/scripts/import-unified-owners/command';

const importer = createImportUnifiedOwnersCommand();
importer().catch((error) => {
console.error(error);
process.exit(1);
});
importer()
.then(() => {
console.log('Done.');
process.exit(0);
})
.catch((error) => {
console.error(error);
process.exit(1);
});

0 comments on commit 87ffb9a

Please sign in to comment.