added additonal 12 gauge types

This commit is contained in:
blaisadmin
2026-03-29 22:45:05 -04:00
parent a0c0d2a9eb
commit 289dbb324b
2 changed files with 37 additions and 9 deletions
+16 -1
View File
@@ -117,7 +117,7 @@ const pool = databaseUrl
password: postgresPassword,
});
const defaultCalibers = ['9mm', '.22 LR', '5.56 NATO', '.308 Win', '12 Gauge', '.45 ACP'];
const defaultCalibers = ['9mm', '.22 LR', '5.56 NATO', '.308 Win', '12 Gauge - Birdshot', '12 Gauge - Buckshot', '12 Gauge - Slug', '12 Gauge Sporting', '.45 ACP'];
const firearmCategories = ['Handgun', 'Rifle', 'Shotgun', 'PCC', 'Other'];
const sessionHours = 24 * 7;
@@ -384,6 +384,21 @@ const ensureSchema = async () => {
};
const ensureProfileDefaults = async (profileId: string) => {
await pool.query(
`UPDATE calibers
SET name = '12 Gauge Sporting',
is_default = TRUE
WHERE profile_id = $1
AND name = '12 Gauge'
AND NOT EXISTS (
SELECT 1
FROM calibers existing
WHERE existing.profile_id = $1
AND existing.name = '12 Gauge Sporting'
)`,
[profileId],
);
for (const caliber of defaultCalibers) {
const caliberResult = await pool.query<CaliberRow>(
`INSERT INTO calibers (profile_id, name, is_default, is_active)