Skip to content

Commit

Permalink
fix: update the migration strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
ludtkemorgan committed Mar 11, 2024
1 parent 8f279c8 commit e711895
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions api/prisma/migrations/01_change_to_prisma/migration.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
-- Doorway specific
DROP VIEW IF EXISTS combined_listings;

-- CreateEnum

CREATE TYPE "user_role_enum" AS ENUM ('user', 'partner', 'admin', 'jurisdictionAdmin');
Expand Down
2 changes: 0 additions & 2 deletions api/prisma/migrations/03_1_combined_listing/migration.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
DROP TABLE IF EXISTS combined_listings;

CREATE VIEW "combined_listings" AS (
SELECT
l.id,
Expand Down
6 changes: 4 additions & 2 deletions build/docker/Dockerfile.backend
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,14 @@ RUN apk update
RUN apk add postgresql

# Add src and types so migrations can run
COPY --from=source --chown=node:node /app/api/index.ts ./
COPY --from=source --chown=node:node /app/api/src ./src
COPY --from=source --chown=node:node /app/api/prisma ./prisma
COPY --from=source --chown=node:node /app/api/scripts ./scripts

## This CMD should be run as the node user
USER node

CMD yarn db:migration:run
# We need to skip all migrations that are just for local development (changes already exist in deployed environment)
CMD yarn db:migration:skip 00_init || true && yarn db:migration:skip 02_hba_to_prisma || true && yarn db:migration:skip 03_0_external_listing || true && yarn db:migration:run
## uncomment the below if starting on a new environment
# CMD yarn db:migration:run

0 comments on commit e711895

Please sign in to comment.