25 lines
980 B
SQL
25 lines
980 B
SQL
--
|
|
-- Reference data required for a working database.
|
|
--
|
|
-- Applied by ./migrateDatabase.sh after migrations. Kept out of the migration
|
|
-- history on purpose: environments that were baselined with
|
|
-- `prisma migrate resolve` never execute 0_init, so seed rows placed inside it
|
|
-- would silently never exist there.
|
|
--
|
|
-- Idempotent, so re-running is harmless.
|
|
--
|
|
|
|
-- attachment_type is a lookup table the application joins against.
|
|
-- attachment_type = 1 is hardcoded for scraped URLs, 2 for uploaded images,
|
|
-- 3 for PDFs (see server/models/Attachment.js). Without these rows a freshly
|
|
-- scaffolded database creates attachments that reference nothing.
|
|
INSERT INTO `attachment_type` (`id`, `mime_type`, `extension`, `name`) VALUES
|
|
(1, NULL, NULL, 'URL'),
|
|
(2, NULL, '.jpg', 'Image - Jpg'),
|
|
(3, NULL, '.pdf', 'PDF'),
|
|
(4, NULL, '.doc', 'DOC')
|
|
ON DUPLICATE KEY UPDATE
|
|
`mime_type` = VALUES(`mime_type`),
|
|
`extension` = VALUES(`extension`),
|
|
`name` = VALUES(`name`);
|