added additonal 12 gauge types
This commit is contained in:
+16
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user