|
1 | 1 | -- First insert API Keys and store their IDs |
2 | 2 | INSERT INTO api_keys (id, key, client, description, created_date, expiration_date, enabled, never_expires, approved, |
3 | 3 | revoked) |
4 | | -SELECT nextval('api_key_sequence'), t.key_value, t.client, t.description, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP + INTERVAL '365 days', t.enabled, t.never_expires, t.approved, t.revoked |
| 4 | +SELECT nextval('api_key_sequence'), t.key, t.client, t.description, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP + INTERVAL '365 days', t.enabled, t.never_expires, t.approved, t.revoked |
5 | 5 | FROM ( |
6 | 6 | VALUES |
7 | 7 | ('ecom-frontend-key-2024', 'E-commerce Frontend', 'API Key for frontend application', true, false, true, false), |
8 | 8 | ('mobile-app-key-2024', 'Mobile Application', 'API Key for mobile app', true, false, true, false), |
9 | 9 | ('admin-dashboard-key-2024', 'Admin Dashboard', 'API Key for admin dashboard', true, true, true, false), |
10 | 10 | -- Internal traffic key (never exposed publicly) |
11 | 11 | ('internal-service-key', 'Internal Service', 'API Key for inter-service calls', true, true, true, false) |
12 | | - ) AS t(key_value, client, description, enabled, never_expires, approved, revoked); |
| 12 | + ) AS t(key, client, description, enabled, never_expires, approved, revoked); |
13 | 13 |
|
14 | 14 | -- Then insert Applications using the actual API key IDs by looking up the key value |
15 | 15 | INSERT INTO applications (id, application_name, enabled, approved, revoked, api_key_id) |
|
0 commit comments